Monday, August 31, 2015

SQL Server database connection string on an alternate port

I recently was setting up multiple SQL Server databases on different servers operating on different ports.

However, one of the points of confusion I had remaining was how to connect to these databases in my connection strings when they were operating on ports other than the default port of 1433?

Fortunately, this article came to the rescue!! http://www.connectionstrings.com/sql-server-2012/

In order to connect to a database operating on an alternate port, you specify a connection string such as the following:

Data Source=DBServer,1434;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

Therefore, you simply separate the port number by a comma, from the database server name (just as you would do in SQL Server Management Studio).

That is all there is to it!!

No comments:

Post a Comment