Blog Post

MSSQL Connection string tester v1.0.0

Friday, April 27, 2018 12:09 AM

The background

While working with SQL server on Azure I had multiple occasions where the communication to the SQL server has been severed.


I have started to use this tool: "Tools-ConnectionStringTester



In order to prove the communication working ensure you have updated Tester.exe.config and replaced all variables.


Update Connection String

Replace "MyDatabaseName" in my config with my real database I want to test against


<add name="ConnectionStringUnderTest" connectionString="Data Source=localhost;Initial Catalog=MyDatabaseName;Integrated Security=True" />


Here you can find some additional connection string sources and syntax


Update Command TimeOut 

If I need to adjust connection string timeout I can using the following configuration

<add key="CommandTimeOut" value="90"/>

Update Testing Command

Finally the application needs to execute command against the database. Update the section "select * from dbo.TestingTable"  as it expect the count of items to be present otherwise It will fail.
NOTE: Using wrong command may affect your database and therefore be careful what are you doing. I do not take any responsibility for how is this tool used.
<add key="SqlCommand" value="select count(*) from (select * from dbo.TestingTable) as underTest" />


Finally here is the full config and how it should look like