How to connect remote sql server(within LAN) using ADO?
-
I want to connect to the sql server database and do some query command via ado. I use this connection string to do that work:"Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DaDian2008;Data Source=localhost;UID=sa;PWD=123456;Network Library=dbmssocn", it works well. But how about with a remote server(LAN). For example, my ip address is 192.168.1.100, i just replace localhost to 192.168.1.100, it would get an exception says: Code = 80004005 Code meaning = Unspecified error Source = Microsoft OLE DB Provider for SQL Server Description = [DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found. Why? And how can i connect to a remote sql server(MS SQL Server within LAN)? btw, if I use "Driver={SQL Server};Server=192.168.1.100;Address=192.168.1.100,1433;Network=DBMSSOCN;User ID=sa;PWD=123456;Database=DaDian2008; Then, I can connect to the database on my locale computer, but it would fail again on another computer.
You need the name/IP address of the server you want to connection to. localhost - 192.168.1.100 and your computer name are all pointing the the instance of SQL server installed on your machine.
Never underestimate the power of human stupidity RAH
-
You need the name/IP address of the server you want to connection to. localhost - 192.168.1.100 and your computer name are all pointing the the instance of SQL server installed on your machine.
Never underestimate the power of human stupidity RAH
-
Thanks for your reply. But my real problem is that, how to connect to a remote ms sql server(within LAN)?
And the answer is to find out the name/IP Address of the server you wish to connect to and use that in the connection string. I assume you have the database set up with credentials on the other server!
Never underestimate the power of human stupidity RAH
-
And the answer is to find out the name/IP Address of the server you wish to connect to and use that in the connection string. I assume you have the database set up with credentials on the other server!
Never underestimate the power of human stupidity RAH
-
Oh, I use my computer as sql server, the code which useing "Driver={SQL Server};Server=192.168.1.100;Address=192.168.1.100,1433;Network=DBMSSOCN;User ID=sa;PWD=123456;Database=DaDian2008" works well on my own computer, but doesn't on another computer.
kcynic wrote:
192.168.1.100
This is a local IP, the other machine is looking for SQL on their machine, not yours. You might try replacing that with a machine name or find out your lan IP. I am presuming you want to use your machine as the SQL server.
Never underestimate the power of human stupidity RAH
-
kcynic wrote:
192.168.1.100
This is a local IP, the other machine is looking for SQL on their machine, not yours. You might try replacing that with a machine name or find out your lan IP. I am presuming you want to use your machine as the SQL server.
Never underestimate the power of human stupidity RAH
But, 192.168.1.100 is the real local IP of mine and i do want to use my machine as the SQL server. You meant, I should replace Server=192.168.1.100 with Server=MyPcName? But, if so, to a client witch knew its server ip only, how should it configure this argument? Unfortunely, if it's not a practice but a C/S product, one of its user is a orgnization with a plenty of members,they all need to install the client program, so they configure the Server argument with their server's correct name. And for another group, they have to do the similar work! In another words, the installation can't be done automately! right?
-
But, 192.168.1.100 is the real local IP of mine and i do want to use my machine as the SQL server. You meant, I should replace Server=192.168.1.100 with Server=MyPcName? But, if so, to a client witch knew its server ip only, how should it configure this argument? Unfortunely, if it's not a practice but a C/S product, one of its user is a orgnization with a plenty of members,they all need to install the client program, so they configure the Server argument with their server's correct name. And for another group, they have to do the similar work! In another words, the installation can't be done automately! right?
You need to define your requirements Are you on a LAN with all the clients How many clients Is you machine the dev box Do you have a UAT server or even a database Do you have a production server/ddatabase Do you have an IT department, b/c if you are it you are in deep do do.
Never underestimate the power of human stupidity RAH
-
You need to define your requirements Are you on a LAN with all the clients How many clients Is you machine the dev box Do you have a UAT server or even a database Do you have a production server/ddatabase Do you have an IT department, b/c if you are it you are in deep do do.
Never underestimate the power of human stupidity RAH
Oh, there are the answers: 1. All clients within a LAN. 2. My pc is a dev box 3. I have MS SQL Server 2005 installed. 4. Of course no product. I just took that as a example 5. Im not a web developer, so b/s has no help for me. No matter how many clients would be, i just only want to know how. Thanks
-
I want to connect to the sql server database and do some query command via ado. I use this connection string to do that work:"Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DaDian2008;Data Source=localhost;UID=sa;PWD=123456;Network Library=dbmssocn", it works well. But how about with a remote server(LAN). For example, my ip address is 192.168.1.100, i just replace localhost to 192.168.1.100, it would get an exception says: Code = 80004005 Code meaning = Unspecified error Source = Microsoft OLE DB Provider for SQL Server Description = [DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found. Why? And how can i connect to a remote sql server(MS SQL Server within LAN)? btw, if I use "Driver={SQL Server};Server=192.168.1.100;Address=192.168.1.100,1433;Network=DBMSSOCN;User ID=sa;PWD=123456;Database=DaDian2008; Then, I can connect to the database on my locale computer, but it would fail again on another computer.
Depending on whether you use C++ or VB, the connection string is slightly different. Look at connectionstrings.com . Also, you should first make sure that you can connect with C:\WINDOWS\system32\odbcad32.exe before playing with your code.
-
Depending on whether you use C++ or VB, the connection string is slightly different. Look at connectionstrings.com . Also, you should first make sure that you can connect with C:\WINDOWS\system32\odbcad32.exe before playing with your code.
-
I want to connect to the sql server database and do some query command via ado. I use this connection string to do that work:"Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DaDian2008;Data Source=localhost;UID=sa;PWD=123456;Network Library=dbmssocn", it works well. But how about with a remote server(LAN). For example, my ip address is 192.168.1.100, i just replace localhost to 192.168.1.100, it would get an exception says: Code = 80004005 Code meaning = Unspecified error Source = Microsoft OLE DB Provider for SQL Server Description = [DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found. Why? And how can i connect to a remote sql server(MS SQL Server within LAN)? btw, if I use "Driver={SQL Server};Server=192.168.1.100;Address=192.168.1.100,1433;Network=DBMSSOCN;User ID=sa;PWD=123456;Database=DaDian2008; Then, I can connect to the database on my locale computer, but it would fail again on another computer.
Identify what is your problem. Is that Network problem or SQL Server problem or both? You are using LAN so test these: 1. Try ping command to/from server & clients’ PCs. (y/n?) 2. Or try file or printer sharing among PCs. If you failed all above tests, you have Network problem. Otherwise you are facing the problem to connect with SQL Server. All Mycroft Holmes’s discussions are about Network problem without being sure what the problem is. I’m waiting to know what your problem is.
-
Identify what is your problem. Is that Network problem or SQL Server problem or both? You are using LAN so test these: 1. Try ping command to/from server & clients’ PCs. (y/n?) 2. Or try file or printer sharing among PCs. If you failed all above tests, you have Network problem. Otherwise you are facing the problem to connect with SQL Server. All Mycroft Holmes’s discussions are about Network problem without being sure what the problem is. I’m waiting to know what your problem is.
Hi... i dont have any network problem but still i'm not able to connect to MS SQL Server which is in another system of my LAN.... Please provide me what to chect wit SQl server and Connection string... pLZZZZZZZZ.......