PHP 手册
后退 |  | 前进

# XCIII. ODBC and DB2 functions (PDO_ODBC)

# 简介

警告
本扩展模块是实验性的。本模块的行为，包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本扩展模块风险自担。

PDO_ODBC is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to databases through ODBC drivers or through the IBM DB2 Call Level Interface (DB2 CLI) library.

On Windows, PDO_ODBC is built into the PHP core by default. It is linked against the Windows ODBC Driver Manager so that PHP can connect to any database cataloged as a System DSN, and is the recommended driver for connecting to Microsoft SQL Server databases.

# 运行时配置

这些函数的行为受 `php.ini` 的影响。

表格 1. PDO_ODBC Configuration Options

Name | Default | Changeable | Changelog
--- | --- | --- | ---
pdo_odbc.connection_pooling | "strict" | PHP_INI_ALL |

有关 PHP_INI_* 常量进一步的细节与定义参见附录 G。

以下是配置选项的简要解释。

pdo_odbc.connection_pooling string

  Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" (equals to ""). The parameter describes how strict the connection manager should be when matching connection parameters to existing pooled connections. `strict` is the recommend default, and will result in the use of cached connections only when all the connection parameters match exactly. `relaxed` will result in the use of cached connections when similar connection parameters are used. This can result in increased use of the cache, at the risk of bleeding connection information between (for example) virtual hosts.

  This setting can only be changed from the `php.ini` file, and affects the entire process; any other modules loaded into the process that use the same ODBC libraries will be affected too, including the Unified ODBC extension.

  警告
  `relaxed` matching should not be used on a shared server, for security reasons.

  > 提示: Leave this setting at the default `strict` setting unless you have good reason to change it.

后退 | 起点 | 前进
overload | 上一级 | PDO_ODBC DSN