0
votes

SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101

OS: Ubuntu 16.04 64Bits

  • Install Informix CSDK (Version 4.10)
  • Compile PDO_INFORMIX (Version 1.3.3)

  • Enable pdo_informix.so extension in apache config

  • Set apache environment variables

    1 - INFORMIXDIR = /opt/informix (where I installed CSDK)

    2 - DB_LOCALE = en_US.819

    3 - CLIENT_LOCALE = en_US.utf8

Connection String: $instance = new PDO("informix:host=$host;service=$port;database=$db;server=ol_standard;protocol=onsoctcp;client_locale=en_US.utf8;db_locale=en_US.819;EnableScrollableCursors=1;OPTIMIZEAUTOCOMMIT=1", $usr, $pwd);

The 23101 error is about DB_LOCALE and CLIENT_LOCALE, but it is all set.

1
yeah, 23101 is definitely about not finding GLS files. Are you sure INFORMIXDIR is correctly set?. Something you can try is to set the environment variable "GLSDEBUG" to "on" (e.g. export GLSDEBUG=on) and check the output running the script. It should trace all the GLS calls, showing which file is failing to open. - jsagrera
You use OPTIMIZEAUTOCOMMIT in all caps. Are you sure you're allowed to use db_locale and not required to use DB_LOCALE? Ditto client_locale and CLIENT_LOCALE? - Jonathan Leffler

1 Answers

1
votes

Looking at the text in the error message, I think you have more than just a locale problem (23101).

If you get: "Unspecified System Error"

rather that: "Unable to load locale categories"

it means the driver was unable to find the correct text message for the -23101 error, which usually happens when INFORMIXDIR is not correctly set.

The '.iem' files (in $INFORMIXDIR/msg/en_us/0333) contains the text message for each error number. If a message can't be found you get a generic 'Unspecified System Error'.

You mentioned Apache, so I guess you are trying to run a PHP code from apache, not just the command line. Apache may not be passing the env variable to the PHP module. If the apache env module (mod_env.so) is enabled, you may want to try putting something like this in your httpd.conf file

 setenv INFORMIXDIR '/opt/informix'   

so the INFORMIDIR variable will be passed to the PDO module.