How to test a database connection

Configuring connection string sometimes can be frustrating.  For example – you restore your app and database to a new machine and connection string doesn`t work.  You`re not sure what’s wrong. Is it username, password, database problem or something else…

There is simple and effective method to test your database connectivity and eliminate database as a problem…

In this example I`ll show you how to test connection to your Microsoft SQL 200x database.

Create a new .txt file somewhere in the system (root of the C:\ , desktop) and rename it to test.udl.

 

Create new .txt document

Rename it toTest.udl

Confirm rename with | Yes

 

 

Your file will look something like this

Now double click on test.udl to start it

New window appears.  Choose Provider tab |From OLE DB Provider(s) choose “Microsoft OLE DB Provider for SQL Server” |Next

On the Connection tab you`ll have to enter following information:

1.Select or enter a server name: enter your server and SQL instance name

2. Enter information to log on the server:  You can use Windows integrated security ( Windows username and pass)  or SQL username and password if you selected „mixed mode“ security (not recommended) while installing your SQL server.

3. Select the database on the server: Choose database that you want to test. Make sure that user you entered has rights to that database.

 

Click on Test Connection

 

Test connection succeeded. Everything is ok with connectivity to your database and you can start looking for problems somewhere else.

 

Disclaimer