Board index » delphi » How to connect to REMOTE MSDE/MS SQL based on IP?

How to connect to REMOTE MSDE/MS SQL based on IP?


2004-08-27 09:32:44 AM
delphi204
The current ADOConnection only provides connecting to a machine via its name, which assumes local network access. How can I access an MSDE on a remote machine based on IP?
 
 

Re:How to connect to REMOTE MSDE/MS SQL based on IP?

"Chloe Liu" <XXXX@XXXXX.COM>writes
Quote

The current ADOConnection only provides connecting to a machine via its
name, which assumes local network access. How can I access an MSDE on a
remote machine based on IP?
Instead of the server name, try the ip address instead. I haven't tried it
for remote connections, but it works fine with a local network.
Mike Walsh
 

Re:How to connect to REMOTE MSDE/MS SQL based on IP?

Chloe Liu writes:
Quote
The current ADOConnection only provides connecting to a machine via its name,
which assumes local network access. How can I access an MSDE on a remote machine based on IP?
You can specify all that in the *connection string*.
In the connection string you have to concatenate some parameters,
separated by semicolons.
Here's a summary of my personal experiences:
Step 1: Specify the Ole DB provider and the database name.
Start with:
Provider=SQLOLEDB;
Persist Security Info=False;
Initial Catalog=mydatabasename;
Step 2: Specify the connection type and the server name.
Using TCP/IP, maybe even a firewall?: Specify IP address and port as
well as the connection library. Default port for MS SQL is 1433 but your
firewall may be configured otherwise:
Data Source=192.168.0.5,1433; Network Library=dbmssocn;
Not doing that? Then use the multiprotocol (RPC) library instead
of tcp/ip and specify the server name, it must be visible in your
local area network:
Data Source=MyServername;
Note: If the server is on your local PC, the name should be (local).
Step 3: Specify the login authentification.
If you want to use Windows NT security for authentification instead of
MS SQL username/password:
Integrated Security=SSPI;
If you want to use MS SQL username/password instead of NT
authentification:
User Id=MyUsername;
Password=MyPassword;
Step 4: Now concatenate all these snippets into a single string
and you're go!
--
Arthur Hoornweg
(please remove the ".net" from my e-mail address)