Tuesday, March 27, 2012

Connecting to SQL Server 2000 from a VB 6.0 app using ADO

How to connect to real ip such as 202.28.94.10 from DCHP ip by use VB 6 .. I don't know about to use connection string ...
My PC is insatalled My SQL Server2000 and has ip 10.98.10.97 that is DHCP ip and another ones is installed the same but that it real ip. Both PC can't to see them together in network

This problem make my first PC can't access database to another one.
Help me plssss...I'm not entirely certain I understood your question. It appears that your SQL server is a DHCP client (and thus it is possible that the IP address will periodically change due to a reboot or a lease renewal (should not happen often, but it is possible).

Is it not possible to connect to the server via its name instead of the IP? Ie, use the DNS server to resolve the IP address?

On the other hand, re-reading your question seems to indicate that you have 2 client workstations, one DHCP and one static. It appears that the static IP client can connect to SQL and the DHCP client cannot. If that is the case, then you appear to have a network issue unrelated to SQL and you must work with the network admin to ensure that connectivity is not being blocked by routing rules.

If I have misunderstood your question, please forgive me.

Sorry, I guess I need a bit more info to help.

Regards,

Hugh Scott

Originally posted by cs423326
How to connect to real ip such as 202.28.94.10 from DCHP ip by use VB 6 .. I don't know about to use connection string ...
My PC is insatalled My SQL Server2000 and has ip 10.98.10.97 that is DHCP ip and another ones is installed the same but that it real ip. Both PC can't to see them together in network

This problem make my first PC can't access database to another one.
Help me plssss...|||Hi hmscott .
What is connection string in VB
My connection string to DHCP ip is "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=G7;Data Source=NUT"

when I will change Data Source from NUT to 10.98.10.97 (This is My DHCP Client IP) it work...
But when i change to Static ip (202.xxx.xxx.xxx) it does not work
How will i do??Please tell me about connection string that can be access to SQL Server..
thx|||Some things to test:

1. Can you Ping the static IP from your workstation (Ping 202.xxx.xxx.xxx).

If not, you need to see your network admin.

2. If you have query analyzer on your client, can you log in to the static IP server?

Again, iff not, you need to see your network admin.

HTH, my understanding gets much fuzzier once you get down to the network layer...

Regards,

Hugh Scott

Originally posted by cs423326
Hi hmscott .
What is connection string in VB
My connection string to DHCP ip is "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=G7;Data Source=NUT"

when I will change Data Source from NUT to 10.98.10.97 (This is My DHCP Client IP) it work...
But when i change to Static ip (202.xxx.xxx.xxx) it does not work
How will i do??Please tell me about connection string that can be access to SQL Server..
thx|||Hi again hmscott.
I ping the static ip from my PC is work..
and I can't use query analyzer log in to static ip server

..my PC (installed SQL Server 2000) and the static ip PC (installed the same) not in the same network ...then Both of them can't connect through SQL Tools.

How can I solve this problem??
and How can I code to connect them with VB?

Please help me again...
Thx.|||Perhaps it would help if you posted the actual error message text. I suggest that you try to set up a registration for the other machine in SQL Enterprise Manager and then copy the text of the error message and post it here|||thx MealinA

This is error message when I tried to Register with SQL Enterprise Manager:

xxx.xxx.xxx.xxx-Login fail for user 'userName'.Reason :Not Associated with a trusted SQL Server Connection;

and

and this is error message when i tried to create DSN :

Connection failed:
SQL State:'28000'
SQL Server Error:18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login fail for user 'user'.Reason :Not Associated with a trusted SQL Server Connection.

Help me plsss...|||See if you can connect with this connection string:

"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=<sa password>;Initial Catalog=G7;Data Source=<ip address>"

If this connects OK then your problem is authentication. I can give you some advice if that is the case...|||Hi MealinA.
I tried to connect my SQL Server with a connection string :
"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=<sa password>;Initial Catalog=G7;Data Source=<ip address>"

but is not work ...
Error :

Runtime error 'xxxxx'
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.

How can I solve that??|||did you replace <sa password> with the sa password for your server and <ip address> with the ip address for your server in the connection string before trying it?|||Yes I do,MealinA.
But It does not work..
and if I tried to connect with my user(created) it show the same result..|||On the server if you go (start->run) svrnetcn.exe and make sure only TCP/IP is listed under enabled protocols. Click on TCP/IP then Properties. The default port should be 1433 and the hide server box should be unchecked.

Also in SQL-EM on the server choose the local machine and then go (Tools->SQL Server Configuration Properties). Go to the Security tab and check that Authentication is set to SQL Server and Windows.

On the client go (start->run) cliconfg.exe and make sure that TCP/IP is the only (or at least the first) protocol listed. Click on TCP/IP then Properties. The default port should be 1433.

Tip: (This assumes you have MDAC 2.6 or higher on your CLIENT pc) Something I do is to use the Alias tab to set and alias for the server. Click Add, then enter MySQLServer in the Server alias box. Choose TCP/IP in the Network Libraries list. Under Connection parameters set Server name to <your server ip address> and check Dynamically determine port. Then use MySQLServer in the connection string. This means if the server ip address changes you can run cliconfg and change the alias without needing to change the connectiion string.

If this is all set up then there is no reason why the client should not connect to the server from SQL Server's perspective. If it still will not connect then I would suggest you carefully analyse your network configuration on the computers involved.

No comments:

Post a Comment