1
votes

i have big problem while connection to a remote informix database server.

here's the code

$db = new PDO("informix:host=192.168.*.*; service=1565;
database=daten; server=name; protocol=onsoctcp; 
EnableScrollableCursors=1", "informix", "info00");

print "Connection Established!\n\n";

echo "Table contents: $rows.\n";

I receive the following error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE=HY000, SQLDriverConnect: -917 [Informix][Informix ODBC Driver][Informix]Must close current database before using a new database.' in /var/www/informix.php:9 Stack trace: #0 /var/www/informix.php(9): PDO->__construct('informix:host=1...', 'informix', 'info00') #1 {main} thrown in /var/www/informix.php on line 9

How can I fix this?

1
Superficially, it appears you already had a database open and were trying to open a different database. But that normally applies to actual DATABASE xyz statements, not to the CONNECT TO 'dbase' notation that should be being used by the PDO driver. Your application should not be connecting as 'informix'; that's tantamount to running as 'root' on a Unix box. Dangerous; powerful but dangerous. Please don't do it. - Jonathan Leffler
Actually, the previous comments about DATABASE xyz vs CONNECT TO 'dbase' show my ESQL/C bias; PDO_Informix uses ODBC, of course. Did you connect to anything before? Presumably not. Are you able to connect to a local database successfully (so it is only remote connections that cause trouble)? - Jonathan Leffler

1 Answers

0
votes

I think you should also set the DB_LOCALE environment variable. When the client application requests a connection, it sends information, including the DB_LOCALE to the database server.