Compartilhar via


Connectivity to SQL server fails when "Network Library = dbmssocn" is used in addtion to having a TCP alias

I recently came across this interesting issue : The end customer was trying to connect to SQL server named instance from a Remote client machine via a asp.net application. The Server instance that he was connecting to already had a TCP alias on the client machine. In the connection string he was specifying "Network Library = dbmssocn". The application was failing in it's attempt when trying to connect to SQL server with the following error message :

Test connection failed because of an error in initializing provider. [DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found.

When we collected the Network Monitor trace , we found that client was attempting to connect to SQL server on the UDP port 1434 rather than the TCP port 1433. While further probing into the issue , as soon as we removed the "Network Library = dbmssocn" from the application's connection string the application was able to connect to SQL server successfully.

To conclude on this issue , we found out that there was no requirement for the developers to specify the network library in the connection explicitly when they already had a TCP alias created for the SQL Server.

Comments

  • Anonymous
    October 13, 2010
    I meet your problem, do you know to config the SQLServer to make it work?
  • Anonymous
    September 09, 2012
    Please let me know the connection string used for SQL Server alias through TCP/IP...
  • Anonymous
    March 31, 2015
    Or leave the tcp: off the front of the Serverinstance name.So, this will work:Network Library=dbmssocn;Data Source=BP1XGBDB307SIVFUNOAT40So will this:Data Source=tcp:BP1XGBDB307SIVFUNOAT40But despite the Microsoft documentation, this will NOT workNetwork Library=dbmssocn;Data Source=tcp:BP1XGBDB307SIVFUNOAT40seetcp:<host name><instance name>The TCP format must start with the prefix "tcp:" and is followed by the database instance, as specified by a host name and an instance name.msdn.microsoft.com/.../system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx