Re: connect to named instance w/ non-default port
- From: "Andrew J. Kelly" <sqlmvpnooospam@xxxxxxxxxxxx>
- Date: Tue, 14 Apr 2009 12:19:00 -0400
As Sylvain stated it might be using a different protocol and tcp may not be enabled on that server. You can use the existing connections event in profiler to see what the connection settings are for each connection or try the activity monitor. And no you should not need the port if you have the right protocol and the browser service is working.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"John A Grandy" <johnagrandy@g-mail-dot-com> wrote in message news:%23IHX05QvJHA.1240@xxxxxxxxxxxxxxxxxxxxxxx
Hi Andrew, and thanks for the response.
This is an external environment and I have no control over how it is configured ( other than to discover obvious mis-configurations and suggest that they be fixed ). I do not know exactly why this Sql Server listens on a non-default non-fixed port , but "it is the way it is".
My concern is finding a connection string that will allow the .NET SqlConnection.Open() method to connect. From what you are saying , it sounds like there is no need to specify the port number in the connection string. However, I am still not able to connect from .NET ( although SSMS works fine ).
Do you have any suggestions for troubleshooting sql connection strings within .NET ?
"Andrew J. Kelly" <sqlmvpnooospam@xxxxxxxxxxxx> wrote in message news:%23aJ%23DIQvJHA.5484@xxxxxxxxxxxxxxxxxxxxxxxJohn,
The SQL Browser service is what resolves the port for you. It listens on port 1434 for SQL Server requests by name/instance and resolves them to the particular port. You can and probably should however fix the port # that the named instance listens on and do not need the browser if you specify that port. Look in BOL under ports [SQL Server] - assigning numbers for details.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"John A Grandy" <johnagrandy-at-gmail-dot-com> wrote in message news:uDflmaKvJHA.1208@xxxxxxxxxxxxxxxxxxxxxxxApparently for named instances which listen
on a non-default port ( i.e. other than 1433 ) , there is no need to specify a port
number in the connection string ( ? )
If so, this is well and good because I am troubleshooting a network where the Sql Server instance is reassigned a new listening port on machine restart.
Indeed , I am able use SSMS to connect to such an instance without
specifying the port number.
However, via my WinForms .NET application using SqlConnection class , the following connection strings do not work.
Data Source=<server name>\<instance name>;Network Library=DBMSSOCN;Initial
Catalog=<db name>;User ID=<user id>;Password=<password>;
Data Source=<server name>\<instance name>,<port number>;Network
Library=DBMSSOCN;Initial Catalog=<db name>;User ID=<user
id>;Password=<password>;
I can connect to the server instance from the client via SSMS and the Sql
Server login used in the connection string ( <user id>/<password> )
I am wondering : what exactly is providing this ability to resolve the
connection request to the correct port number ?
Is it driver/provider dependent ?
Is it configuration dependent ?
Or should it "just work" out of the box for SqlConnection ? ( i.e. I have some other problem going on )
Thanks.
.
- References:
- connect to named instance w/ non-default port
- From: John A Grandy
- Re: connect to named instance w/ non-default port
- From: Andrew J. Kelly
- Re: connect to named instance w/ non-default port
- From: John A Grandy
- connect to named instance w/ non-default port
- Prev by Date: Re: connect to named instance w/ non-default port
- Next by Date: Re: connect to named instance w/ non-default port
- Previous by thread: Re: connect to named instance w/ non-default port
- Next by thread: Re: connect to named instance w/ non-default port
- Index(es):
Relevant Pages
|