You can use HTTP(s) tunneling when the client needs access to a website database from a remote machine, but direct access to the database server on the specified port is forbidden. In conditions of restricted connectivity, when the database server is hidden behind a firewall or you need to transmit private network data through a public network, you can set up an HTTP tunnel to create a direct network link between the two locations.
If the firewall allows HTTP(S) connections, you can use the connector with a properly configured web server to connect to the database server. The connector comes with a PHP script that enables access to the database server through an HTTP tunnel. The tunnel.php
script file is located in the \site-packages\devart\ase\http\
directory.
You need to deploy it on a web server which will act as an HTTP tunneling server. The script must be accessible through HTTP—you can verify its accessibility in any web browser. The web server must support PHP 5 or later.
You can also use the Secure Shell forwarding, or SSH to tunnel network traffic. However, SSH is designed to encrypt traffic rather than traverse firewalls. Note that traffic tunneling or encryption increases the CPU and bandwidth usage. It is recommended that you use direct connection whenever possible.
import devart.ase
connect()
module method and obtain a connection
object.
my_connection = devart.ase.connect(
Server="your_server",
Database="your_database",
UserId="your_username",
Password="your_password",
UseHttp="True",
HttpUrl="https://hostname/tunnel.php",
HttpTrustServerCertificate="True"
)
The following table describes the HTTP tunneling parameters.
Parameter | Description |
---|---|
|
Enables HTTP tunneling. |
|
The URL of the PHP script for HTTP tunneling |
|
The username for the password-protected directory that contains the HTTP tunneling script |
|
The password for the password-protected directory that contains the HTTP tunneling script |
|
Specifies whether to verify the server certificate chain during a TLS handshake. By default, the connector verifies the entire certificate chain. The possible values are |
If the HTTP tunneling server isn't directly accessible from the client machine, you can connect through a proxy server.
The following table describes the HTTP proxy parameters.
Parameter | Description |
---|---|
|
The hostname or IP address of the proxy server |
|
The proxy port |
|
The username for proxy authentication |
|
The password for proxy authentication |