From: Wesley Chen Date: 2009-04-09T10:43:17+09:00 Subject: Re: How to remote connect to the SQL server 2005 when there is a ‘\’ in the SQL server name, such as 192.168.0.11\active? --0016e6441e2816c4d90467155f5a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, Sean, Thank you very much for your post. In fact, the developers in my team using Java, when they connect the remote SQL server instance, they use the same host and port 1433 as I set in my script. When I use connection_string << "Server=myServerName\\theInstanceName" and connection_string << "Data Source=#{*@host*}, 1433;" Then run my script, I will get the same error *[dbmssocn] **General network error. Check your network documentation. *Have you got any other idea? I have searched a lot from the net, but I can't succeed. Additional: I can ping Local_IP telnet Local_IP 1433 successfully. I can ping remote_IP But when telnet remote_ip\\instance 1433, I failed, no connection. Does it matter? Thanks. Wesley Chen. On Wed, Apr 8, 2009 at 11:59 PM, Sean O'Halpin wrote: > On Wed, Apr 8, 2009 at 8:57 AM, Wesley Chen wrote: > > Hi, Sean, > > Thank you very much. > > > > I have tried following your advice. > > In the connection string below, I replace the *@host* with the format > > *myServerName\the > > InstanceName* or *myServerName\\the InstanceName* > > I can't succeed. > > On local machine, when the @host is just an IP address, I can succeed. > > > > connection_string = "Provider=SQLOLEDB.1;" > > connection_string << "Persist Security Info=False;" > > connection_string << "User ID=#{@username};" > > connection_string << "password=#{@password};" > > connection_string << "Initial Catalog=#{database};" > > connection_string << "Data Source=#{*@host*}, 1433;" > > Did you try > > connection_string << "Server=myServerName\\theInstanceName" > > I'm not sure this is right: > > > connection_string << "Data Source=#{*@host*}, 1433;" > > As far as I remember, named instances won't be running on port 1433. > > Regards, > Sean > > --0016e6441e2816c4d90467155f5a--