I. What is SQLRelay? SQLRelay is an open source database pool connected to the Proxy Server 2. What databases does SQLRelay support? * Oracle * MySQL * mSQL * PostgreSQL * Sybase * MSSQLServer * IBMDB2 * Interbase * Sybase * SQLite * Lago * ODBC * MSAccess III. installation and configuration
I. What is SQL Relay? SQL Relay is an open source database pool connected to the Proxy Server 2. What databases does SQL Relay support? * Oracle * MySQL * mSQL * PostgreSQL * Sybase * ms SQL Server * IBM DB2 * Interbase * Sybase * SQLite * Lago * ODBC * MS Access III. installation and configuration
I. What is SQL Relay?
SQL Relay is an open source database pool connected to the Proxy Server
Ii. What databases does SQL Relay support?
* Oracle
* MySQL
* mSQL
* PostgreSQL
* Sybase
* MS SQL Server
* IBM DB2
* Interbase
* Sybase
* SQLite
* Lago
* ODBC
* MS Access
3. installation and configuration;
Don't talk nonsense, start to Install SQL Relay, to the http://sqlrelay.sourceforge.net/to download the corresponding software
To Install SQL Relay, you need to install Rudiments first, which can be found in the http://sqlrelay.sourceforge.net/download.html
1. Install Rudiments:
# tar vxzf rudiments-0.28.2.tar.gz
# cd rudiments-0.28.2
# ./configure --prefix=/usr/local/rudiments
# make
# make install
Now, rudiments installation is complete.
2. Install SQL Relay:
# Tar vxzf sqlrelay-0.36.4.tar.gz
# Cd sqlrelay-0.36.4
#. /Configure -- prefix =/usr/local/sqlrelay -- with-rudiments-prefix =/usr/local/rudiments -- with-mysql-prefix = MySQL installation path -- with-freetds-prefix = FreeTDS installation path -- with-oracle-home = Oracle installation path -- with-php-prefix = PHP installation path
# Make
# Make install
After the installation is complete, the above compilation parameters are set based on individual needs. Because I need Oracle SQLserver MySQL at the same time, so many parameters are added.
3. Set PHP:
Modify php. ini
extension_dir = "./"
Modify the preceding content:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20050922"
It is modified according to the PHP installation path. Not every version of PHP uses this path.
Add the following content to php. ini:
extension=sql_relay.so
Next, we will introduce how SQL Relay connects to SQL Server.
Modify the configuration file FreeTDS. conf of freetds.
Add the following content:
[msde]
host = 172.16.20.203
port =1433
tds version = 8.0
client charset = GB2312
Modify as needed
4. Modify the SQL Relay configuration file
# cd /usr/local/sqlrelay/etc
# cp sqlrelay.conf.example sqlrelay.conf
Change the content of sqlrelay. conf:
< !DOCTYPE instances SYSTEM "sqlrelay.dtd">
< instances>
< instance id="msdetest" port="9000" socket="/tmp/msdetest.socket" dbase="freetds" connections="5" maxconnections="10" maxqueuelength="0" growby="1" ttl="60" endofsession="commit" sessiontimeout="5" runasuser="nobody" runasgroup="nobody" cursors="5" authtier="listener" handoff="pass">
< users>
< user user="sa" password="sa"/>
< /users>
< connections>
< connection connectionid="msdetest" string="server=msde;db=pubs;user=sa;password=sa;" metric="1"/>
< /connections>
< /instance>
< /instances>
4. Start SQL Relay and test it;
1. Start SQL Relay
# export PATH=$PATH:/usr/local/sqlrelay/bin
# sqlr-start -id msdetest
2. Use SQL tools:
# sqlrsh -id msdetest
You can enter SQL statements directly.
Stop SQL Relay:
# sqlr-stop msdetest
3. Test PHP:
Write a PHP file with the following content:
$con=sqlrcon_alloc("msdetest",9000,"/tmp/msdetest.socket","sa","sa",0,1);
$cur=sqlrcur_alloc($con);
sqlrcur_sendQuery($cur,"select * from t_gifts");
for ($row=0; $row for ($col=0; $col echo sqlrcur_getField($cur,$row,$col);
echo ",";
}
echo "
\n";
}
sqlrcur_free($cur);
sqlrcon_free($con);
?>
Run the PHP file to check whether data exists.
End of full text ~~
Reference: http://hi.baidu.com/mrvsumbeujeinxe/item/8ba0c60888cf47c490571896