Re: Bug with instanceName property?



This is actually easier to explain in pseudo code. It works something like:

If you specify a portnumber attempt to connect using port number.
//attempt to connect 1 round trip.
else if you specify instance name
Query SqlBrowser for port number of instance name specified //1
roundtrip
//attempt to connect. 2nd round trip

It is much cheaper for us to connect to a server when you specify the port
number (1 round trip versus 2), so every time you specify a port number we
will avoid the roundtrip to query the sqlbrowser (ignore the instance name
you specify) and attempt to connect to the server on the port you specify.

Does this make sense?
--
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/




"Wes Clark" <WesClark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DF398F67-AE3B-4412-9CED-72A41EAB35D8@xxxxxxxxxxxxxxxx
>I appreciate your speedy reply. What is the relationship between the
> instanceName and the port number? I installed SQL Server 2005 on a
> machine
> that already had SQL Server 2000 on it, so that's why I gave it an
> instance
> name different from the default. I've also read that by specifying the
> port,
> you get a more efficient connection since it doesn't need to connect to
> the
> SQL Browser service first.
>
> I see now from the help file on the Network Configuration help file that
> named instances always use dynamic ports, so when I specify the port 1433,
> I
> am specifically requested the default instance on that box. Perhaps the
> documentation for port number and instanceName could mention that
> non-default
> instance names always use dynamic ports, so that specifying a port doesn't
> make sense.
>
> What is interesting is the connection will succeed unless I specify a
> database name. To wit,
> jdbc:sqlserver://ITH:1433;instanceName=SQLSERVER2005;user=sa;password=123;
> Connected!
>
> Kind of strange. I suggest the
> jdbc:sqlserver://ITH:1433;instanceName=SQLSERVER2005;forwardReadOnlyMethod=direct;user=sa;password=123;
> Connected!
> jdbc:sqlserver://ITH:1433;instanceName=SQLSERVER2005;forwardReadOnlyMethod=direct;databaseName=cc;user=sa;password=123;
> com.microsoft.sqlserver.jdbc.SQLServerException: Failed
> Logon:com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open
> database
> requested in login 'cc'. Login fails.
>
> I can confirm what you are saying, however, by removing the port
> specification when I use the instanceName parameter syntax:
> jdbc:sqlserver://ITH;instanceName=SQLSERVER2005;user=sa;forwardReadOnlyMethod=direct;databaseName=cc;password=123
> Connected!
>


.



Relevant Pages

  • Re: SQL2005: Cannot connect error 11001
    ... I believe the complete Windows auth user access is too complicate, ... which trusted connection is meant? ... it would still be listening on the old port. ... Microsoft, SQL Server Books Online ...
    (microsoft.public.sqlserver.connect)
  • Re: Installing Sql Server Express on Vista Home Premium
    ... It seems that your SQL Server instances are Named Instances, ... Default Instances uses 1433 TCP port by default as a Static Port but not the ... If you change your Connection String as following, ...
    (microsoft.public.sqlserver.setup)
  • Re: SQL Server 2005 Connection Problems
    ... - it is't completely clear what the SQL Server Browser is for. ... connection reqest was being rejected. ... I think the problem is still likely the the port is blocked by some ... firewall between the server and that client. ...
    (microsoft.public.sqlserver.setup)
  • Re: Cannot connect to SQL Express on 2003 Machine from XP machine
    ... enable network communication ... make sure that the port isn't blocked ... "An error has occurred while establishing connection to the server. ... When connecting to SQL Server 2005, this failure may be caused by the ...
    (microsoft.public.sqlserver)
  • Re: Cannot connect to SQL express database ????
    ... However, yes, you are correct that if SQL Server Express Edition is using dynamic ports, then the port could change to one that is blocked by the firewall. ... This connection string using sytax ... >>> I can manage without any problem my database from the VIsta ...
    (microsoft.public.sqlserver.connect)