沃梦达 / 编程问答 / php问题 / 正文

如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作?

How do I get connection pooling working on a PHP-CGI PDO iSeries Access UnixODBC Connection?(如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作?)

本文介绍了如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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).

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

Pooling = Yes

在我的 odbc.ini 和

in my odbc.ini and

CPTimeout = 600 

在我的 odbcinst.ini 中

in my odbcinst.ini

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

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.

这是我的完整 ODBC 配置文件:

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

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

推荐答案

Pooling         = Yes

这需要在您的 odbcinst.ini 而不是您的 odbc.ini 文件中的 [ODBC] 下进行

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

CPTimeout       = 600

把它放在你的 odbc.ini 中

Put this in your odbc.ini

这篇关于如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作?

基础教程推荐