views:

80

answers:

2

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

+1  A: 

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.

David
Thank you! It worked ...
Mike
please comment if you're going to downvote an answer
David
A: 

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.

Tiberiu Ana