Informix

 View Only
Expand all | Collapse all

Need help to Informix and PHP con

  • 1.  Need help to Informix and PHP con

    Posted Thu January 07, 2021 08:00 PM

    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


  • 2.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 01:36 AM
    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
    ------------------------------



  • 3.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 10:39 AM

    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.819
    OPTIMIZEAUTOCOMMIT=1
    ENABLESCROLLABLECURSORS=1

    $stmt = $db->query("select * from cadprod");
    $res = $stmt->fetchPDO::FETCH_BOTH );
    $rows = $res[0];
    echo "Table contents: $rows.</br>";

    catch (PDOException $e) {
        echo "ERR : " . $e->getMessage();
    }


    Any idea ?

    thanks !


    ------------------------------
    BRUNO ORTIZ
    ------------------------------



  • 4.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 10:55 AM
    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
    ------------------------------



  • 5.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 11:06 AM

    Is PHP actually finding the ini file ? 

     

    Cheers

    Paul

     






  • 6.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 11:22 AM

    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
    ------------------------------



  • 7.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 11:26 AM
    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





  • 8.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 10:49 AM
    Oh i forgot, the version of CSDK is 3.70

    ------------------------------
    BRUNO ORTIZ
    ------------------------------



  • 9.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 05:47 AM
    Bruno:

    Please post your connection string!

    Art

    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 10.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 10:45 AM
    Hi Art, 

    i reply to @Sheshnarayan Agrawal​ with the old and "new other" problem and the connections

    if you can help me, i will be grateful haha

    ------------------------------
    BRUNO ORTIZ
    ------------------------------



  • 11.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 01:40 PM
    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
    ------------------------------



  • 12.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 01:57 PM
    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





  • 13.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 02:40 PM
    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
    ------------------------------



  • 14.  RE: Need help to Informix and PHP con

    Posted Fri January 08, 2021 03:24 PM
    Humm Ok, 

    how i do this ? You can do a exemple ?

    Tks

    ------------------------------
    BRUNO ORTIZ
    ------------------------------



  • 15.  RE: Need help to Informix and PHP con

    IBM Champion
    Posted Fri January 08, 2021 03:39 PM
    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


    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.








  • 16.  RE: Need help to Informix and PHP con

    Posted Sat January 09, 2021 01:10 AM
    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
    ------------------------------