如何在PHP-CGI PDO iSeries Access UnixODBC连接上获得连接池?

时间:2015-02-18 12:46:22

标签: php db2 odbc connection-pooling unixodbc

我正在尝试使用PHP / PDO和一个名为iSeries Access for Linux的UnixODBC驱动程序来实现连接池的工作。

我没有在我的PDO构造函数中设置PDO :: ATTR_PERSISTENT,因为我想使用池而不是持久性(我在PHP-CGI环境中)。

使用我已放置的http://www.ibm.com/developerworks/systems/library/es-linux_bestpract.html的“连接池”部分

Pooling = Yes

在我的odbc.ini和

CPTimeout = 600 

在我的odbcinst.ini

但是,似乎ODBC驱动程序不是连接池,因为每次页面刷新都会生成与传入连接相关的CPIAD09消息。

以下是我的完整ODBC配置文件:

==== odbc.ini ====
[AS400]
Description             = Production AS/400 Database
Driver                  = iSeries Access ODBC Driver
System                  = XXX.XXX.X.X
UserID                  = XXXXXXXX
Password                = XXXXXXXX
Naming                  = 0
DefaultLibraries        = USERLIB, BPCSF, ADV, WEB, RITAUSR
Database                =
ConnectionType          = 0
CommitMode              = 2
ExtendedDynamic         = 0
DefaultPkgLibrary       = QGPL
DefaultPackage          = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression    = 1
LibraryView             = 0
AllowUnsupportedChar    = 0
ForceTranslation        = 0
Trace                   = 0
DSN                     = AS400
Pooling                 = Yes

==== odbcinst.ini ====
[iSeries Access ODBC Driver]
Description     = iSeries Access for Linux ODBC Driver
Driver          = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so
Setup           = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so
NOTE1           = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2           = the following Driver64/Setup64 keywords will provide that support.
Driver64        = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64         = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading       = 2
DontDLClose     = 1
UsageCount      = 1
CPTimeout       = 600

2 个答案:

答案 0 :(得分:0)

增加连接池的数量将永远继续。

答案 1 :(得分:0)

Pooling         = Yes

这需要在你的odbcinst.ini下的[ODBC]下,而不是你的odbc.ini文件

CPTimeout       = 600

把它放在你的odbc.ini