Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
Internet browsing has suggested me following connection string to access remote DB, attached to remote SQL server.

"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;"




I want to access the DB over internet, not over LAN. My question is about the IP address and port.

1)What IP address I should use instead of 190.190.200.100? I mean how I can know what IP address my server has.
2) How to check the what port my server is using? Is it always 1433?

Thanks


[edit]Code block fixed[/edit]
Posted
Updated 28-Jun-13 7:05am
v2

1) Get your external IP address for your server with : www.whatismyip.com

2) Create a virtual server or/and configure port forwarding on your ADSL modem and firewall.
 
Share this answer
 
Comments
Furqan Sehgal 28-Jun-13 12:15pm    
Thanks ! I have done process 1. Please guide me little further about 2
Mehdi Gholam 28-Jun-13 12:21pm    
That depends on your modem and firewall, start by going into the web interface on your modem, and reading the manual for "virtual servers" and "port forwarding".
XML
<connectionStrings>
        <add name="ConnectionName" connectionString="Data Source=Server;Initial Catalog=DBNAME;User ID=USERID;Password=PASSWORD; >

    </connectionStrings>



Server: Server Name, Get the Server IP and you need to give that IP here.

DB will be connected.
 
Share this answer
 
Comments
Furqan Sehgal 30-Jun-13 3:36am    
Thanks Kutti, I am confused about password and username. Is is sa and the password of sa?
secondly, if there are multiple instances on my SQL server and have the DB with same name (all of them) how will my connection string recognise which instance to connect with?
KuttiSankar 30-Jun-13 3:43am    
Yes, you can identify the Instance by 'IP\Instance Name' '
say (190.190.200.100)\sqlexpress'.

give DB name after that.

& You may not have same Name for Different databases in a same instance. try this.
Furqan Sehgal 30-Jun-13 4:36am    
and the user ID is sa or it is the one I gave while installing SQL server instance?
Furqan Sehgal 30-Jun-13 4:44am    
I have given following connection string, but it says can not find server/instance
Data source=216.172.147.133;143\reomotetest; initial catalog=dbInvoices;user id=sa;password=abc123
1433 is my port, and I have done the forwarding as well
KuttiSankar 30-Jun-13 5:47am    
Mostly we used to give sa only. but i don't know what the password you gave while install, and i am not sure port number we need to give. is 'remotetest' instance name?
Ensure your username and password.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900