Connection through HTTP tunnel(using http protocol)

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 UniDAC together with HTTP tunneling software to connect to MySQL server.

UniDAC supports 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.

You need to deploy the tunnel.php script, which is included into the provider package on the web server. It allows access to the database server to use HTTP tunneling. The script must be available through the HTTP protocol. You can verify if it is accessible with a web browser. The script can be found in the HTTP subfolder of the installed provider folder, e. g. %Program Files%\Devart\UniDac for Delphi X\HTTP\tunnel.php. The only requirement to the server is PHP 5 support.

To connect to the database, you should set TUniConnection parameters for usual direct connection, which will be established from the web server side, the Protocol specific MySQL option to mpHttp, and set the following parameters, specific for the HTTP tunneling:

Specific Option Mandatory Meaning
HttpUrl Yes Url of the tunneling PHP script. For example, if the script is in the server root, the url can be the following: http://localhost/tunnel.php.
HttpUsername, HttpPassword No Set this properties if the access to the website folder with the script is available only for registered users authenticated with user name and 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 MySQL server listens on port 3307. 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 specific options you have to setup the Proxy specific options as follows:

UniConnection := TUniConnection.Create(self);
UniConnection.ProviderName := 'MySQL';
UniConnection.Server := '192.168.0.10';
UniConnection.Port := 3307;
UniConnection.Username := 'root';
UniConnection.Password := 'root';
UniConnection.SpecificOptions.Values['Protocol'] := 'mpHttp';
UniConnection.SpecificOptions.Values['HttpUrl'] := 'http://server/tunnel.php';
UniConnection.SpecificOptions.Values['ProxyHostname'] := '10.0.0.1';
UniConnection.SpecificOptions.Values['ProxyPort'] := '808';
UniConnection.SpecificOptions.Values['ProxyUsername'] := 'ProxyUser';
UniConnection.SpecificOptions.Values['ProxyPassword'] := 'ProxyPassword';
UniConnection.Connect;

Note that setting the Proxy specific options automatically enables proxy server usage.

Delphi UniDAC 通过http协议连接数据库的设置的更多相关文章

  1. 四层协议给站点设置独享ip

    四层协议给站点设置独享ip 初始化为四层节点 设置独占ip 设置独享的产品不用预设置分组 增加站点 创建站点后,在分组解析里会自动创建一个以站点名为名称的分组并且会自动分配一个独享的ip在这个分组里( ...

  2. Delphi 2005 以上版本GIF动画播放设置

    源: Delphi 2005 以上版本GIF动画播放设置

  3. 在Delphi中关于UDP协议的实现

    原文地址:在Delphi中关于UDP协议的实现作者:菜心 首先我把UDP无连接协议的套接字调用时序图表示出来 在我把在Delphi中使用UDP协议实现数据通讯收发的实现方法总结如下:   例子描述:下 ...

  4. delphi uniDac

    Delphi 2010安装及使用UniDAC 4.0 UniDAC是一个功能强大的非可视化跨数据库的数据访问组件,可用于Delphi,Delphi for .NET,C++Builder,and La ...

  5. 连接数据库超时设置autoReconnect=true

    1,问题现象: com.mysql.jdbc.CommunicationsException: The last packet successfully received from the serve ...

  6. 在Delphi中调用"数据链接属性"对话框设置ConnectionString

    项目需要使用"数据链接属性"对话框来设置ConnectionString,查阅了一些资料,解决办法如下: 1.Delphi 在Delphi中比较简单,步骤如下: 方法1: use ...

  7. iOS 使用UI控件的外观协议UIAppearance进行设置默认UI控件样式

    在iOS开发中,经常会对UINavigationBar的样式进行全局样式.采用的设置方式有两种: 第一种,采用方式如下: [UINavigationBar appearance] 这种是对一类对象的默 ...

  8. Delphi编程中Http协议应用

    Http协议的通信遵循一定的约定.例如,请求一个文件的时候先发送Get请求,然后服务器会返回请求的数据.如果需要进行断点传输,那么先发送'HEAD /'请求,其中返回的'Content-Length: ...

  9. 问题-Delphi记忆工程打开的单元(XE2设置项)

    问题情况:每次在delphi中打开了N个单元的窗口,关闭delphi后,第二天还得一个一个打开单元窗口.问题原因:这是因为delphi的记忆功能未打开.问题处理:Tools->Options.. ...

随机推荐

  1. 红米手机连接logcat,调试信息刷屏解决办法

    我买了红米,平时拿它来当作安卓测试机的 可是把它接入eclipse里面,发现它会往logcat打印大量的日志,我自己想调试一个程序的时候,自己的程序的日志一会儿就被冲刷没了 新建一个logcat me ...

  2. File类的源码学习

    File类是Java中IO部分的一个类,用于表示文件或者目录的.关于File类有很多的常规操作这里就不介绍了,来看一下不常规的东西. File英文意思是文件,但是它也可以用来表示目录,文件的概念还是比 ...

  3. Y2K Accounting Bug - 2586

      Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11271   Accepted: 5672 Description Ac ...

  4. 解决google登录界面input输入框颜色不正确问题

    加入以下样式: input:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px #e2e2e2 inset !important; }

  5. java 性能检测工具 检测死锁等

    死锁检测方法 1 JConsole 找到需要查看的进程,打开线程选项卡,点击检测死锁 2 jps查看java进程ID,使用jstack  7412输出信息 3 使用jvisualvm连接java虚拟机 ...

  6. Angular1.0 在Directive中调用Controller的方法

    Controller中定义了$scope.method = function(){} Directive中需要引入$scope http://stackoverflow.com/questions/2 ...

  7. iOS图片无损拉伸

    一张图片如果放大的话一般情况下会失真,如果该图片是规则的,比如这个聊天气泡,可以用如下代码来设置 UIImage *rightImg = [UIImage imageNamed:@"Sen ...

  8. POJ1850&&POJ1496

    Code Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9236   Accepted: 4405 Description ...

  9. 【BZOJ5018】[Snoi2017]英雄联盟 背包

    [BZOJ5018][Snoi2017]英雄联盟 Description 正在上大学的小皮球热爱英雄联盟这款游戏,而且打的很菜,被网友们戏称为「小学生」.现在,小皮球终于受不了网友们的嘲讽,决定变强了 ...

  10. java排序(整理)

    冒泡排序(面试都要问的算法) 一.基本思想:每次比较相邻的两个 元素,按需调整顺序   二.题目:要求将 12 35 99 18 76 这 5 个数进行从大到小排序   三.思路: (1)先比较第 1 ...