How do I get connection pooling working on a PHP-CGI PDO iSeries Access UnixODBC Connection?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 18:58:47

问题


I am trying to get connection pooling working using PHP/PDO with a UnixODBC driver called iSeries Access for Linux.

I do not set the PDO::ATTR_PERSISTENT in my PDO constructor as I want to use pooling and not persistence (I am in a PHP-CGI environment).

Using the "Connection Pooling" section of http://www.ibm.com/developerworks/systems/library/es-linux_bestpract.html I have placed

Pooling = Yes

in my odbc.ini and

CPTimeout = 600 

in my odbcinst.ini

However, it seems that the ODBC driver is not connection pooling because every page refresh generates the CPIAD09 related message of an incoming connection being made.

Here are my full ODBC configuration files:

==== 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

and

==== 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

回答1:


Increase the number of connection pool will always go on.




回答2:


Pooling         = Yes

This needs to go under [ODBC] in you odbcinst.ini and NOT your odbc.ini file

CPTimeout       = 600

Put this in your odbc.ini



来源:https://stackoverflow.com/questions/28584050/how-do-i-get-connection-pooling-working-on-a-php-cgi-pdo-iseries-access-unixodbc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!