ODBC on IBM DB2

Help
RubberMan
2006-05-12
2013-04-09
  • RubberMan
    RubberMan
    2006-05-12

    Hello,

    I installed PHP5.0.4 on OS400/PASE (IBM iSeries).
    Everthing runs fine.

    Now I installed PHPLIB 7.4a on the apache webserver (on the iSeries) and followed the installation instructions.

    I use the prepend.php file (not the prepend.php3)!

    With the page 'showoff.php3' I get my login-form.
    When I tried to login with the user 'kris' I get following error-message:

    <pre>
    Debug: query = select user_id, perms from php.auth_user where username = 'kris' and password = 'test'
    UID:c14cbf141ab1b7cd009356f555b607dc°
    Length:33
    Debug: query = select val from php.active_sessions where sid = 'c14cbf141ab1b7cd009356f555b607dc°'and name = 'Example_User'
    Warning: odbc_exec() [function.odbc-exec]: SQL error: Mit 'c14cbf14' beginnende Zeichenkonstante nicht begrenzt., SQL state 42603 in SQLExecDirect in /www/apachedft/php/db_odbc.inc on line 134

    Database error: Invalid SQL: select val from php.active_sessions where sid = 'c14cbf141ab1b7cd009356f555b607dc°'and name = 'Example_User'
    ODBC Error: 1 (General Error (The ODBC interface cannot return detailed error messages).)
    Session halted.
    </pre>
    (Sorry, error message is in German, it says that the String 'c14cbf14.. it not limited by "'")

    The first select on the database 'auth_user' gives me a UID. I changed the DB_ODBC.INC to aktivate the debug-mode and to print the contend of the field $UID und the length of this field.
    You will see, that the length of the $UID is 33 charakters, in the database I have only 32 charaters.
    The phplib-class gives an additional charakter (code=0) back (I marked it in the error message as '°').
    I think that I will have the same problem with the other fields und perhaps other databases, too.
    E.g. I checked the content of the field $perms.
    I got the value 'admin°' ( '°' stands for code 0) instead of 'admin'.

    I checked the field values of my database 'auth_user' twice!
    I wrote a php-programm to query the content with a sql-select manually, that means I did this without the phplib-classes.
    With my php-programm I recieve the values correct, without the additional code0-charakter.
    My opinion is, that there must be a bug in the DB_ODBC class.
    My knowledge in PHP is, unfortunatly, not good enought, to solve this problem by my own.

    I hope, some of the members here will be able to fix my problem.

    Thank for you help.

    Greetings from Germany
    and sorry for my horrible English!

    Volker