ODBC Driver for SQL Server

HTTP Tunneling

Connection through HTTP tunnel

Sometimes client machines are shielded by a firewall that does not allow you to connect to server directly at the specified port. If the firewall allows HTTP connections, you can use HTTP tunneling based on the PHP script.

An example of the web script tunneling usage can be the following: you have a remote website, and access to its database through the port of the database server is forbidden. Only access through HTTP port 80 is allowed, and you need to access the database from a remote computer, like when using usual direct connection.

To start using HTTP tunneling, you should deploy the Tunneling script. The php script must be available through the HTTP protocol. You can verify it is accessible for a web. For this enter the http://www.domain.com/tunnel.php address to a web browser and check the result. The only requirement to the server is PHP 5 support.

P.S.: tunnel.php is provided along with ODBC Driver for SQL Server. It is available at the driver installation path, in the http folder, by default: C:\Program Files (x86)\Devart\ODBC\SQL Server\http\tunnel.php

To connect to the database, you should set connection parameters for usual direct connection and set the following parameters specific for the HTTP tunneling:

Option Description

Use Http

Enables or disables HTTP tunneling.

Http Url

Holds the url of the tunneling PHP script.

Http Username

Set these properties if the access to the website folder with the script is available only for registered users authenticated with user name and password.

Http Password

Connection through proxy and HTTP tunnel

Consider the previous case with one more complication.

HTTP tunneling server is not directly accessible from client machine. For example, client address is 10.0.0.2, server address is 192.168.0.10, and the SQL Server server listens on port 1433. The client and server reside in different networks, so the client can reach it only through proxy at address 10.0.0.1, which listens on port 808. In this case in addition to the HTTP options, you have to setup Proxy options as follows:

Using ODBC Data Source Administrator

proxyHttp

Using Conenction String

Login Prompt=False;User ID=sa;Data Source=192.168.0.10;Port=1433;Use Http=true;Url=http://server/tunnel.php;Proxy Hostname=10.0.0.1;Proxy Port=808;Proxy User=ProxyUser;Proxy Password=ProxyPassword;

Connection Options Description

Option Description

Proxy Host Name

Holds the host name or IP address of the proxy server to connect to.

Proxy Port

Used to specify the port number for TCP/IP connection with proxy server.

Proxy Username

Holds the proxy server account name.

Proxy Password

Holds the password for the proxy server account.

Additional information

Technically speaking, there is one more way to tunnel network traffic. The Secure Shell forwarding, or SSH, can be used for forwarding data. However, main purpose of SSH is traffic encryption rather than avoiding firewalls or network configuration problems. The SSH Connection article describes how to use SSH protocol in ODBC Driver for SQL Server.

Keep in mind that traffic tunneling or encryption always increase CPU usage and network load. It is recommended that you use direct connection whenever possible.

© 2015-2017 Devart. All Rights Reserved. Request Support ODBC Forum Provide Feedback