Install and use SQLRelay in the PHP database connection pool

Source: Internet
Author: User
Tags php database
PHP database connection pool SQLRelay installation use from: http://blog.csdn.net/21aspnet/article/details/50774684


SQL Relay follows the instructions on its official website http://sqlrelay.sourceforge.net/index.html: a powerful database connection management solution.

In other words, SQL Relay is an open source database pool to connect to the proxy server.

Currently, SQL Relay supports many databases:

SQL Relay supportsOracle, MySQL, PostgreSQL, SAP/Sybase, IBM DB2, Informix, Firebird and SQLiteDatabases directly, using the native client API's for those databases.
Support is provided for Microsoft SQL Server viaFreeTDSAPI.

The supported APIs are also very rich.

Guides: C ++, C, C #, Perl, PHP, Python, Ruby, Java, TCL, Erlang, node. js
References: C ++, C, C #, Perl, PHP, Python, Ruby, Java, TCL, node. js,

I will explain how to use the connection pool in the Linux + PHP + FreeDTS environment. In fact, PHP-> SQL Relay-> FreeDTS-> database architecture.

The following describes how to install and use

1. install rudiments first

We recommend that you install the new version whenever possible. an error may occur in the old version.

# Wget http://sourceforge.net/projects/rudiments/files/rudiments/0.28.2/rudiments-0.28.2.tar.gz/download
# Tar xvzf rudiments-0.54.tar.gz
# Cd rudients-0.54
#./Configure -- prefix =/usr/local/rudiments
# Make & make install

2. install sqlrelay again.

# Wget https://sourceforge.net/projects/sqlrelay/files/sqlrelay/0.64/sqlrelay-0.64.tar.gz/download
# Tar vxzf sqlrelay-0.64.tar.gz
# Cd sqlrelay-0.64
#. /Configure -- prefix =/usr/local/sqlrelay -- with-rudiments-prefix =/usr/local/rudiments -- with-freetds-prefix =/usr/local/freetds --- php-prefix =/usr/local/php


# Make & make install

3. modify the php configuration file

# Vim/usr/local/php/lib/php. ini
Add extension

extension ="sql_relay.so"
Note: You need to confirm that phpinfo

4. modify freeDTS configuration

FreeDTS installation reference this article: http://blog.csdn.net/unix21/article/details/47449901

Modify the configuration file FreeTDS. conf of freetds.
# Vim/usr/local/freetds/etc/freetds. conf

Add the following content

[msdetest]host = 192.168.1.1port =1433tds version = 7.0client charset = UTF-8
Otherwise, Chinese characters are garbled and the corresponding encoding type GB2312 is required.

5. modify the SQL Relay configuration file

# Cd/usr/local/sqlrelay/etc/
# Cp sqlrelay. conf. example sqlrelay. conf
# Vim sqlrelay. conf

The configuration is very easy to understand.

 
 
  
   
    
   
   
    
   
  
 

6. start SQL Replay

# Export PATH = $ PATH:/usr/local/sqlrelay/bin
Start:

# Sqlr-start-id msde

Is started successfully. if the configuration is incorrect, the system will prompt that the database cannot be connected.

SQL tools

# Sqlrsh-id msde


7. use the connection pool in php

 \n";}sqlrcur_free($cur);sqlrcon_free($con);?>

The front-end webpage retrieves data from the connection pool

SQL Relay PHP function API

Http://sqlrelay.sourceforge.net/sqlrelay/programming/php.html

Reference: http://www.cnblogs.com/zhangjun516/archive/2013/03/12/2955162.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.