Informix PDO connection fails.

When I try to connect to an informix database with the PDO connection, I get the following error when I test the connection:

Connection Error

Connection attempt failed: SQLSTATE=01S00, SQLDriverConnect: -11005 [Informix][Informix ODBC Driver]Invalid connection string attribute.

I can connect to the database with the same connection information through the native Informix connection. And if I create a simple stand along test php program, it will connect fine.

So, there must be some problem with what you are feeding the Informix PDO connector.

Nick

Hello Nick,

Do you have Infomix Instant Client installed on your server?

Have you seen our tutorial? http://downloads.scriptcase.com.br/downloads/v7/manual/en_us/webhelp/manual_mp/06-Tutoriais/05-informix/05-informix_PDO.htm

PS: You do not have to uninstall your current web server if you already have informix extension installed. And if you do, please make sure that it is “Turned on”.

regards,
Bernhard Bernsmann

Bernhard,

Informix is installed. I can connect to Informix databases using the native Informix client in Scriptcase. And I can connect to PDO_Informix if I run the following code from the scriptcase server root.


<html><body>
<?php
$link = new PDO("informix:host=xxxx; service=wyndev_tcp; database=ddddd; server=cecil_wyndev; protocol=onsoctcp; EnableScrollableCursors=1", "uuuu", "ppp");
$sql = "select *, rowid, current mytime from ar_dpmt";
foreach ($link->query($sql) as $row){
//var_dump($row);
echo $row['P_CUST'];
echo "<br>";
}
?>
done
</body></html>

Hello,

Issue reported to our bugs team.

regards,
Bernhard Bernsmann

SOLVED - Informix PDO connection fails.

The problem turned out to be with our configuration and the not enough documentation. I eventually dug through the SC code enough to figure out that ‘service’ defaults to 9908 (the default Informix port).

The error message indicates a bad connection string, but really it was a failure to connect on the 9908 port. We use custom ports depending on which copy of Informix we want to connect to.

Once I figure that out, I corrected the connection string and it worked.

format is

informix_server\server_dns:service

Thanks for your feedback. I will talk to our documentation responsible to make sure this information gets added so future users won’t face the same issue as you did.

regards,
Bernhard Bernsmann