PHP
PDO_PGSQL DSN> <pg_version
Last updated: Mon, 12 Sep 2005

CXII. PostgreSQL Functions (PDO_PGSQL)

简介

警告

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

PDO_PGSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to PostgreSQL databases.

目录
PDO_PGSQL DSN -- Connecting to PostgreSQL databases


add a note add a note User Contributed Notes
PostgreSQL Functions (PDO_PGSQL)
amiller at php dot net
14-Jan-2007 12:12
If you want to use "Aliasing" in your code, that is to define the DSN string in the php.ini file as described in the documentation for the constructor object for PDO itself (ex.)

try {
   $dbh = new PDO("foo");
} catch(PDOException $e) {
   echo $e->getMessage();
}

for the Aliasing to work, the DSN MUST be defined in the following way, following the syntax exactly... that is with double quotes, the equal sign, etc. I dinked around with this for quite some time before I figured this out. Again, that is no space between the dsn alias and the equals sign, no space after the equals sign, double quotes around the DSN, not single quotes, and spaces in between the attributes, not semicolons. I am not sure about whether you must also designate all the connection attributes show here or not but this is what ultimately worked for me.

pdo.dsn.foo="pgsql:host=localhost port=5432 dbname=foodb user=foouser password=foopassword"

PDO_PGSQL DSN> <pg_version
Last updated: Mon, 12 Sep 2005