This opens select statements 'for update' by default in db2. If you're using db2, you have to tack on 'for read only' at the end to select from SYSCAT.TABLES, for example, without firing an error like
Warning: SQL error: [IBM][CLI Driver][DB2/LINUX] SQL0151N The column "MAXFREESPACESEARCH" cannot be updated. SQLSTATE=42808 , SQL state 42808 in SQLExecDirect
For example :
$query = odbc_exec($conn, "select * from syscat.tables for read only");
odbc_result_all($query);
will work (only for db2). I don't know about other databases.
The select statement will work in the 'db2' command line, but not in php, because of this side effect.