Database Connection Strings

This post will show you an easy way to Get SQL Server Database Connection String. Before you proceed with the steps below, please make sure you have Visual Studio installed on your machine. If not, you can download the latest Visual Studio installer here.

You might also want to check this article:

This are the format for a connection strings:

  • Microsoft SqlClient Data Provider for SQL Server
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
  • MySQL Connector/Net

How to Get SQL Server Connection Strings using Visual Studio

There is also another way to generate a connection string. That is by using the Visual Studio SQL Server Object Explorer. Follow the steps below.

  1. Open Visual Studio IDE. Navigate to the menu bar then select View » SQL Server Object Explorer.
SQL Database Connection

2. A new window will be open on the left pane. This will allow you to connect to an existing SQL server in your machine. You may refer to the image below.

SQL Database Connection
Server Object Explorer Location

3. Connect to your server using the button with plus sign located at the top of the Server Object Explorer window.

SQL Database Connection
Connect to Server

4. A new window will prompt asking you what server to connect to. You may select the server you want to establish a connection with. This option will also ask you to choose an Authentication. In my case, I prefer Windows authentication. Click the connect button to proceed.


  • Windows Authentication » This is the default authentication used by SQL Server. This uses windows user to authenticate with SQL Server.
  • SQL Server Authentication » This authentication is validated with SQL Server’s master database.
SQL Database Connection
Choose Server

5. Navigate back to the SQL Server Object Explorer window. Select the database where you want to view the connection strings. In my case, I’ll check basicfunction database connection string.

SQL Database Connection
Select Database

6. To view the connection string. Go to the database properties, which are located just below your solution explorer. Then find the database Connection String.


Now, Copy the connection string and paste it to your application for your application where you need database connectivity.


In this article, we have listed the default format of database connection strings. We also added a connection string for MySQL. This article also provides steps on how we can get the connection strings using the Visual Studio IDE. Hopefully, this helps. Happy coding!

Also read: Difference Between sql and plsql