Need help to Informix and PHP con
Posted in 2021
Bruno Ortiz got ODBC errors -11005 and -11041 connecting PHP/PDO to Informix on OpenSuse with CSDK 3.70. Art Kagel and Paul Watson found the DSN and string fine and asked if the ini file was found. Bruno then got -23101, which Paul said was a locale mismatch. Art and Sheshnarayan Agrawal advised setting DB_LOCALE and CLIENT_LOCALE (en_US.819 on Unix). No final result posted.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ODBC / JDBC / .NET
Hello there, i had issues with php connection and Informix in OpenSuse, this is my error, when i try the connection: SQLSTATE=HY000, SQLDriverConnect: -11005 [Informix][Informix ODBC Driver]Unspecified System Error = -11005. Can anybody help me? ------------------------------ BRUNO ORTIZ ------------------------------ #Informix
Hi Bruno, What's the version of CSDK you are using (esql -V)? Sometimes this issue comes due to 32/64-bit mismatches. The error code suggests that it has indeed connected to database, could you check the session to be available on the database side? Could you share the connection string you are using? -11005 : Invalid connection string attribute. For SQLDriverConnect(), the function returned SQL_SUCCESS_WITH_INFO, which means that the function completed successfully, and that a nonfatal error occurred. The nonfatal error occurred because the connection string contains an invalid attribute keyword, but Informix CLI connected to the data source anyway. For more information, call SQLError(). Thanks -Shesh ------------------------------ Sheshnarayan Agrawal ------------------------------
Bruno: Please post your connection string! Art ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Hi Sheshnarayan,
My String con is:
try
{
/*$db = new PDO("informix:host=172.16.18.120; service=9088;
database=bd_jpessoa_m; server=ol_matriz; protocol=onsoctcp;
EnableScrollableCursors=1;", "informix", "loooge");*/ <-- On this version i have the Error [Informix][Informix ODBC Driver]Unspecified System Error = -11005.
$db
=
new
PDO
(
"informix:DSN=Infdrv33"
,
""
,
""
); <-- On this version i have the Error :
SQLSTATE=HY000, SQLDriverConnect: -11041 [Informix][Informix ODBC Driver]Unspecified System Error = -11041.1
with this odbc.ini
[Infdrv33]
Driver=/opt/informix/lib/cli/iclis09b.so
Description=INFORMIX 3.3 32-BIT
Database=bd_jpessoa_m
LogonID=informix
pwd=loooge
Servername=ol_matriz
DB_LOCALE=en_US.819OPTIMIZEAUTOCOMMIT=1
ENABLESCROLLABLECURSORS=1
$stmt
=
$db
->
query
(
"select * from cadprod"
);
$res
=
$stmt
->
fetch
(
PDO
::FETCH_BOTH );
$rows
=
$res
[
0
];
echo
"Table contents:
$rows
.</br>"
;
}
catch
(
PDOException
$e
) {
echo
"ERR : "
.
$e
->
getMessage
();
}
Any idea ?
thanks !
------------------------------
BRUNO ORTIZ
------------------------------
Hi Art, i reply to with the old and "new other" problem and the connections if you can help me, i will be grateful haha ------------------------------ BRUNO ORTIZ ------------------------------
Oh i forgot, the version of CSDK is 3.70 ------------------------------ BRUNO ORTIZ ------------------------------
Bruno: I don't see anything wrong with either the connection string or the DNS definition in the odbc.ini file. At first I thought "Maybe the 3.70 CSDK didn't support scrollable cursors, but no, I checked and that's fine. I just don't use ODBC enough to have a quick answer for you. Anyone else? Art ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Is PHP actually finding the ini file ? Cheers Paul
Hi Paul, humm, i really don't know how to answer you, is there any way to get another return ? Because i believe it is ------------------------------ BRUNO ORTIZ ------------------------------
Me neither, 11041 is bad DSN or can't find ini file - the DSN looks fine to me .... I think open source ODBC driver comes with a tool that can test comms from the command line, you give it the ini file path from command line Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
Guys, no metter what i do, doesn't work, but i have a new error when i try with a first connection string without break the lines, [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101 i have no ideia, i tried all solutions that i found. Anyone please haha ? ------------------------------ BRUNO ORTIZ ------------------------------
That is a locale mismatch - so you are making a connection now Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
Bruno: Now it sounds like your environment variables are not set correctly. You should be able to include the locale in the connection string. ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Humm Ok, how i do this ? You can do a exemple ? Tks ------------------------------ BRUNO ORTIZ ------------------------------
You can add the DB_LOCALE=<locstring> to your connection string and/or the odbc.ini file. The locale string should be the same as the one that the database is using (see sysmaster.sysdatabases for the locale of the database). Art Art S. Kagel, President and Principal Consultant ASK Database Management www.askdbmgt.com Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.
Hi Bruno,
Kindly ensure CLIENT_LOCALE and DB_LOCALE values to be correct and either set in the connection string or in the environment from where you are running your PHP application. DB_LOCALE you can see from your sysdbslocale table of sysmaster database as follows. The below query will give you value of DB_LOCALE that you have to set. For CLIENT_LOCALE, if its English database, you can set to en_US.819 on Linux/Unix and en_US.CP1252 on Windows.
select dbs_collate from sysmaster:sysdbslocale where dbs_dbsname='bd_jpessoa_m';Thanks
-Shesh
------------------------------
Sheshnarayan Agrawal
------------------------------