Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > How to remote connect to the SQL server 2005 when th ere is a‘\’ in the SQL server name, such as 192.168.0.1 1\active?

Reply
Thread Tools

How to remote connect to the SQL server 2005 when th ere is a‘\’ in the SQL server name, such as 192.168.0.1 1\active?

 
 
Wesley Chen
Guest
Posts: n/a
 
      04-07-2009
Hi, Guys,

How to remote connect to the SQL server 2005 when there is a =91\=92 in the=
SQL
server name, such as 192.168.0.11\active?

In fact, when I try to remote connect it by the SQL 2005 client, everything
goes well.

On local, there is a SQL 2005 server, it is:
*Server name:* 192.168.132.157
*User:* Wesley
*Password:* 111111
I can connect it successfully by:
*db=3DSqlServer.new('192.168.132.157', 'Wesley', '111111')*

*db.open(=91active_local=92)*

But on another remote server, it is SQL 2005 with the value like:
*Server name:* 192.168.0.11\thesql
*User:* Wesley
*Password:* abc?de
I can't connect it successfully by:
*db=3DSqlServer.new('*192.168.0.11*\thesql', 'Wesley', 'abc?de')*

*db.open('active_int')*
or
*db=3DSqlServer.new('*192.168.0.11*\\thesql', 'Wesley', 'abc?de')*

*db.open('active_int')*

I get error message:

E:/NetbeansProjects/ActiveTrainer/lib/sql-server.rb:*26*:in
`method_missing': Open (WIN32OLERuntimeError)

OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server

* [dbmssocn] **General network error. Check your network
documentation. *

HRESULT error code:0x80020009

Exception occurred. from
E:/NetbeansProjects/ActiveTrainer/lib/sql-server.rb:26:in `open'

from E:/NetbeansProjects/ActiveTrainer/lib/sql-server.rb:76

The *26 *above points to the sentence below in Red color.

My connect string is:

*def initialize(host, username =3D 'sa', password=3D'')*

* @connection =3D nil*

* @data =3D nil*

* @host =3D host*

* @username =3D username*

* @password =3D password*

*end*

* *

*def open(database)*

* # Open ADO connection to the SQL Server database*

* connection_string =3D "Provider=3DSQLOLEDB.1;"*

* connection_string << "Persist Security Info=3DFalse;"*

* connection_string << "User ID=3D#{@username};"*

* connection_string << "password=3D#{@password};"*

* connection_string << "Initial Catalog=3D#{database};"*

* connection_string << "Data Source=3D#{@host};"*

* connection_string << "Network Library=3Ddbmssocn"*

* **@connection =3D WIN32OLE.new('ADODB.Connection')*

*End*


**

I connect the remote SQL server by SQL 2005 client, using the username and
password above, I succeed.
Appreciated to any suggestions.


Thanks.
Wesley Chen.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to remote connect to the SQL server 2005 when th ere is a‘\’ in the SQL server name, such as 192.168.0.1 1\active? Wesley Chen Ruby 9 04-14-2009 11:36 AM
Substitutions based on Posix ERE's in perl Peter Makholm Perl Misc 1 04-06-2009 03:47 PM
Help. Getting a An error has occurred while establishing a connectionto the server. When connecting to SQL Server 2005, this failure may be causedby the fact that under the default settings SQL Server does not allow remote aboutjav.com@gmail.com ASP .Net 0 05-03-2008 12:43 PM
Visual Studio .NET 2005 WebParts can't connect to SQL Server 2005 XJ ASP .Net 8 01-07-2008 08:51 AM



Advertisments