Link to home
Create AccountLog in
Avatar of shahjagat
shahjagatFlag for United States of America

asked on

Connection string pointing to a database on a different network.


I have this following requirement.
My Web Application is hosted on Server A.
My Database is hosted on Server B.

Server A and Server B are not on same network.
How can i point my connection string to the database in this scenario?
Can any one give an example for this kind of Connection String?

Avatar of arilani

In the connection string you have to put the Server B public IP Address.

But you need to have enablesd the sqlserver por and redirected to it in the router
Avatar of shahjagat


Hi arilani, slightwv,

so,i guess you will need a static ip for the server hosting the database.

If the database server does not have a static ip, is it possible to conenct to a remote database?

you can have an account un DynDSN and use the DSN name
I'm mainly an Oracle person and my SQL Serer is pretty weak.  

You should be able to use hostname but in Oracle the database prefers to run on a server with a static IP address.  I can only guess SQL Server is similar in that respect.
Avatar of arilani

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Major problem with dynamic IP and connections is that when IP changes Cannection will be dropped and need to be re-established. At that point in time DNS might not be completely updated yet that will create problems. Connection string will not be different from the one on local network. If this is custom application developed it may be designed to overcome restrictions of dynamic ip.
vvk is right, but dynamics IPs changes just 1 or 2 times a day. And in a web app you don't mantain connections, so you won't have problem with that.