目录搜索
文字
分享

PDO_INFORMIX DSN

(PECL PDO_INFORMIX >= 0.1.0)

PDO_INFORMIX DSNConnecting to Informix databases

说明

The PDO_INFORMIX Data Source Name (DSN) is based on the Informix ODBC DSN string. Details on configuring an Informix ODBC DSN are available from the » Informix Dynamic Server Information Center. The major components of the PDO_INFORMIX DSN are:

DSN prefix

The DSN prefix is informix: .

DSN

The DSN can be either a data source setup using odbc.ini or a complete » connection string.

范例

Example #1 PDO_INFORMIX DSN example using odbc.ini

The following example shows a PDO_INFORMIX DSN for connecting to an Informix database cataloged as Infdrv33 in odbc.ini:

1

$db = new PDO("informix:DSN=Infdrv33", "", "");

1

2

3

4

5

6

7

8

9

10

11

[ODBC Data Sources]

Infdrv33=INFORMIX 3.3 32-BIT[Infdrv33]

Driver=/opt/informix/csdk_2.81.UC1G2/lib/cli/iclis09b.so

Description=INFORMIX 3.3 32-BIT

Database=common_db

LogonID=testuser

pwd=testpass

Servername=ids_server

DB_LOCALE=en_US.819

OPTIMIZEAUTOCOMMIT=1

ENABLESCROLLABLECURSORS=1

Example #2 PDO_INFORMIX DSN example using a connection string

The following example shows a PDO_INFORMIX DSN for connecting to an Informix database named common_db using the Informix connection string syntax.

1

2

3

$db = new PDO("informix:host=host.domain.com; service=9800;

    database=common_db; server=ids_server; protocol=onsoctcp;

    EnableScrollableCursors=1", "testuser", "tespass");

用户评论:

[#1] phanx at phanx dot com [2010-01-07 01:56:07]

When connect to the Dynamic Informix Server, got this error log in apache's error log file:

[Wed Dec 30 12:44:11 2009] [error] [client 1.1.1.1] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE=HY000, SQLDriverConnect: -11005 [Informix][Informix ODBC Driver]Unspecified System Error =  -11005.' in /opt/webroot/informix.php:5\nStack trace:\n#0 /opt/webroot/informix.php(5): PDO->__construct('informix:host=l...', 'username', 'password')\n#1 {main}\n  thrown in /opt/webroot/informix.php on line 5

you should export correct INFORMIXDIR enviroment variable for root user and restart the web server.

and another error:
 
[Wed Dec 30 13:10:10 2009] [error] [client 1.1.1.1] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE=01S00, SQLDriverConnect: -11005 [Informix][Informix ODBC Driver]Invalid connection string attribute.' in /opt/webroot/informix.php:5\nStack trace:\n#0 /opt/webroot/informix.php(5): PDO->__construct('informix:host=l...', 'username', 'password')\n#1 {main}\n  thrown in /opt/webroot/informix.php on line 5

you should let your connection string in one line, without line feed.

上一篇:下一篇: