Connecting with remote SQL Server DB - sql-server

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

Related

Connect to SQL Server from a local LAN computer

I have a SQL Server 2008 - R2 database - database - configured to receive connection from internet.
The computers from LAN (Local clients) can connect to the database with its local IP address 192.168.100.200.
The computers from internet can connect to the db with its forwarded port through the public IP address, 123.128.28.184.
Due to some coding circumstance, I can only connect to the database through public address when I'm in LAN. So I need the local clients to connect to the public IP address 123.128.28.184, but this seems not possible.
Network configuration is shown as in 1st picture.
The [?] connection returns error in 2nd picture.
How can I use my local client to connect to my database server through the public address?

Encrypting connection to SQL Server at an IP address

Is it possible to cause SQL Server (2014 or later) to encrypt connections, if that server isn't on DNS (i.e. accessed via IP address)? I understand that an SSL certificate can only be tied to a domain name, but that doesn't always prevent its use without the server being at that domain name, such as via an SslStream.
Thanks

How to connect to SQL Server through firewall

I have a SQL Server (clustered named instance) in our intranet and we have an application sittitng outside the intranet.
How can we setup a connection from our application to the database (port opening?).
Please suggest
Thanks
You can get a port opened and append the port number to the server name or IP address used in your connection string - separated with comma, this allows you to connect to SQL.

Remote connection to SQL Server Express fails

I have two computers that share the same Internet IP address. Using one of the computers, I can remotely connect to a SQL Server database on the other. Here is my connection string:
SqlConnection connection = new SqlConnection(#"Data Source=192.168.1.101\SQLEXPRESSNI,1433;Network Library=DBMSSOCN;Initial Catalog=FirstDB;Persist Security Info=True;User ID=username;Password=password;");
192.168.1.101 is the server, SQLEXPRESSNI is the SQL Server instance name, and FirstDB is the name of the database.
Now, I have another computer with a different Internet IP address. I want to connect to the server above using the third computer that does not belong to my local area network. I dont have access to that third computer at the moment, so I want to use (if possible) the client computer in LAN again.
SqlConnection connection = new SqlConnection(#"Data Source=SharedInternetIP\SQLEXPRESSNI,1433;Network Library=DBMSSOCN;Initial Catalog=FirstDB;Persist Security Info=True;User ID=username;Password=password;");
Does not work
Note that I am a beginner, so I am not quite sure what I am doing even though I know what I want to do. By passing the Internet IP to the SqlConnection object rather than the local IP address, how can I successfully connect to the server computer, using the client computer in the same network? Also note that my ultimate goal is to connect to the server with an external client, but I don't have access to that computer right now. I'd appreciate any help.
SQL Server Express doesn't allow remote connection by default.
How to: Configure Express to accept remote connections
How to configure SQL Server 2005 to allow remote connections
Configuring SQL Server Express 2005 for Remote Access when SQL Server does not allow remote connections
Enable Remote Connection on SQL Server 2008 Express
or just enter "enable sql server express remote connection" in Google or Bing and you'll get gazillion of answers....

Accessing SQL Server using an IP Address and Port Number ... Help!

I need to access an SQL Server that is on a machine behind a firewall and you access this machine using an ip address like 95.95.95.33:6930 (not the real ip address) ... But, you get my point that by accessing 95.95.95.33 on port 6930, the firewall routes the requests to that particular machine ...
My question is ... How do you construct a connection string to access the machine at address 95.95.95.33:6930 and then further access the SQL Server on port 1433 or maybe a different port like 8484 ???
Thanks
Mike
well, you build the connection string like this
"Server=95.95.95.33,6930;database=mydb;..."
the firewall/nat will have to route that to the correct machine/port of the SQL server for you.
All you should worry about is the public address and port number of the SQL server. It makes no difference to you to which internal machine and port number the connection is forwarded to.
You then build a connection string as described on connectionstrings.com:
Data Source=95.95.95.33,6930;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
DBMSSOCN=TCP/IP. This is how to use
TCP/IP instead of Named Pipes. At the
end of the Data Source is the port to
use. 1433 is the default port for SQL
Server.

Resources