PHP Doku:: Connecting to Informix databases - ref.pdo-informix.connection.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAbstraktionsebenenPHP Data ObjectsPDO TreiberInformix Functions (PDO_INFORMIX)PDO_INFORMIX DSN

Ein Service von Reinhard Neidl - Webprogrammierung.

Informix Functions (PDO_INFORMIX)

<<Informix Functions (PDO_INFORMIX)

MySQL Functions (PDO_MYSQL)>>

PDO_INFORMIX DSN

(PECL PDO_INFORMIX >= 0.1.0)

PDO_INFORMIX DSNConnecting to Informix databases

Beschreibung

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.

Beispiele

Beispiel #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:

$db = new PDO("informix:DSN=Infdrv33", "", "");
[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

Beispiel #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.

$db = new PDO("informix:host=host.domain.com; service=9800;
    database=common_db; server=ids_server; protocol=onsoctcp;
    EnableScrollableCursors=1", "testuser", "tespass");


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
phanx at phanx dot com
7.01.2010 10:56
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.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)