Delphi UniDAC 通过http协议连接数据库的设置
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协议连接数据库的设置的更多相关文章
- 四层协议给站点设置独享ip
四层协议给站点设置独享ip 初始化为四层节点 设置独占ip 设置独享的产品不用预设置分组 增加站点 创建站点后,在分组解析里会自动创建一个以站点名为名称的分组并且会自动分配一个独享的ip在这个分组里( ...
- Delphi 2005 以上版本GIF动画播放设置
源: Delphi 2005 以上版本GIF动画播放设置
- 在Delphi中关于UDP协议的实现
原文地址:在Delphi中关于UDP协议的实现作者:菜心 首先我把UDP无连接协议的套接字调用时序图表示出来 在我把在Delphi中使用UDP协议实现数据通讯收发的实现方法总结如下: 例子描述:下 ...
- delphi uniDac
Delphi 2010安装及使用UniDAC 4.0 UniDAC是一个功能强大的非可视化跨数据库的数据访问组件,可用于Delphi,Delphi for .NET,C++Builder,and La ...
- 连接数据库超时设置autoReconnect=true
1,问题现象: com.mysql.jdbc.CommunicationsException: The last packet successfully received from the serve ...
- 在Delphi中调用"数据链接属性"对话框设置ConnectionString
项目需要使用"数据链接属性"对话框来设置ConnectionString,查阅了一些资料,解决办法如下: 1.Delphi 在Delphi中比较简单,步骤如下: 方法1: use ...
- iOS 使用UI控件的外观协议UIAppearance进行设置默认UI控件样式
在iOS开发中,经常会对UINavigationBar的样式进行全局样式.采用的设置方式有两种: 第一种,采用方式如下: [UINavigationBar appearance] 这种是对一类对象的默 ...
- Delphi编程中Http协议应用
Http协议的通信遵循一定的约定.例如,请求一个文件的时候先发送Get请求,然后服务器会返回请求的数据.如果需要进行断点传输,那么先发送'HEAD /'请求,其中返回的'Content-Length: ...
- 问题-Delphi记忆工程打开的单元(XE2设置项)
问题情况:每次在delphi中打开了N个单元的窗口,关闭delphi后,第二天还得一个一个打开单元窗口.问题原因:这是因为delphi的记忆功能未打开.问题处理:Tools->Options.. ...
随机推荐
- Linux_经常使用命令
1. ls显示文件夹文件夹及文件使用方式: ls -lt -a 显示文件夹下全部文件及文件夹包括 . 与 .. -A 显示文件夹下全部文件及文件夹不包括 . 与 .. -l 显示文件夹下全部文件及文件 ...
- Linux基础知识之挂载详解(mount,umount及开机自动挂载)
Linux基础知识之挂载详解(mount,umount及开机自动挂载) 转载自:http://www.linuxidc.com/Linux/2016-08/134666.htm 挂载概念简述: 根文件 ...
- windows 和 linux 上 循环读取文件名称的区别和方法
function showGetFileName($type){ $url="/opt/mobile_system/gscdn"; //另一台服务器映射到linux过来的路径. # ...
- android bug archive
console提示: No Launcher activity found! The launch will only sync the application package on the devi ...
- 小技巧:怎样以另外的Windows用户执行SSMS
可能会碰到这种问题.你须要在一台机器上面使用不同的Windows账户连接到SQL Server做測试.默认情况下,你须要用不同的Windows账户登录然后測试. 实际上不须要每一个windows登陆. ...
- json性能测试
http://www.open-open.com/lib/view/open1434377191317.html
- cobbler pxe-menu
对应的文件在 /var/lib/tftpboot/pxelinux.cfg下 如果profile的pxe-menu设置为1的话,就可以默认显示在menu上了.可以手动选择要下发哪一个profile. ...
- vue实践---vue配合express实现请求数据mock
mock数据是前端比较常见的技术,这里介绍下vue配合express 实现请求数据mock. 第一步: 安装 express : npm install express -D 第二步: 简历需要mo ...
- MySQL的max()函数使用时遇到的小问题
通常我们获取某个表的某个字段最大值时可以使用max()函数. 使用场景举例: 获取某个表id的最大值:SQL: SELECT max(id) FROM table_name; SELECT max(` ...
- java并发编程基础---Sky
1.线程及启动和终止 1.1 线程 -进程/优先级 操作系统调度的最小单元是线程,线程是轻量级进程. 线程优先级由setPriority(int)方法来设置,默认优先级是5,等级1~10.等级越高分的 ...