ID: 22971 Updated by: [EMAIL PROTECTED] Reported By: anton at esrr dot ru Status: Open Bug Type: ODBC related Operating System: Linux RedHat 8 PHP Version: 4.3.1 New Comment:
Dan: Would the real fix be to disable that HAVE_SQL_EXTENDED_FETCH for DB2 altogether? Previous Comments: ------------------------------------------------------------------------ [2003-04-02 20:07:47] anton at esrr dot ru >You had the correct category before, IBMs DB2 uses ODBC. > >Try calling odbc_set_option and changing your CURSOR to >SQL_CURSOR_FORWARD_ONLY, this should fix a few things for >your DB2 >install. Ok. I'll try. Thank you. But on this moment the positive result has achieved by commenting out strings containing #define HAVE_SQL_EXTENDED_FETCH 1 in php_odbc_includes.h, as described in Bug #9869 (http://bugs.php.net/bug.php?id=9869). I commented out all lines with this string, but I think that DB2 CLI part enough. ------------------------------------------------------------------------ [2003-04-02 18:41:43] [EMAIL PROTECTED] You had the correct category before, IBMs DB2 uses ODBC. Try calling odbc_set_option and changing your CURSOR to SQL_CURSOR_FORWARD_ONLY, this should fix a few things for your DB2 install. ------------------------------------------------------------------------ [2003-04-02 18:23:48] anton at esrr dot ru . ------------------------------------------------------------------------ [2003-03-30 22:38:16] anton at esrr dot ru Sorry for my english. I've php + Db2.(./configure --with-ibm-db2=/home/db2inst1/sqllib) Now. For exaple, i'm trying to execute such script: <?php function dbconnect($verbose) { $dbname = "SAMPLE"; $username = "db2inst1"; $password = "ibmdb2"; // odbc_connect returns 0 if the connection attempt fails; // otherwise it returns a connection ID used by other ODBC functions $dbconn = odbc_connect($dbname, $username, $password); if (($verbose == TRUE) && ($dbconn == 0)) { echo("Connection to database failed."); $sqlerror = odbc_errormsg($dbconn); echo($sqlerror); } else echo "connection successfull\n"; $q="Select count(*) from SYSIBM.SYSTABLES"; echo "preparing query"; $rs=odbc_prepare($dbconn,$q); return($dbconn); } dbconnect(TRUE); ?> And I'm getting next result: [EMAIL PROTECTED] htdocs]$ php ./tdb.php connection successfull preparing query Warning: SQL error: [IBM][CLI Driver][DB2] SQL0228N FOR UPDATE clause specified for read-only cursor "SQLCUR4 ". SQLSTATE=42620 , SQL state 42620 in SQLPrepare in /usr/local/apache/htdocs/tdb.php on line 20 [EMAIL PROTECTED] htdocs]$ [EMAIL PROTECTED] htdocs]$ db2 "? SQL0228N" SQL0228N FOR UPDATE clause specified for read-only cursor "<cursor-name>". Explanation: Cursor "<cursor-name>" is defined as INSENSITIVE SCROLL, but the corresponding SELECT statement contains a FOR UPDATE clause. The statement cannot be processed. User Response: To define a read-only cursor, specify INSENSITIVE on DECLARE CURSOR, but do not specify the FOR UPDATE clause as part of the SELECT statement of the cursor. sqlcode: -228 sqlstate: 42620 I think that in function odbc_prepare cursor is created. So I'm trying to add parameter SQL_CUR_USE_ODBC to connect string. That is "$dbconn = odbc_connect($dbname, $username, $password,SQL_CUR_USE_ODBC )". Result is changed, but it is wrong result: php ./tdb.php Warning: SQL error: [IBM][CLI Driver] CLI0150E Driver not capable. SQLSTATE=S1C00, SQL state S1C00 in SQLSetConnectOption in /usr/local/apache/htdocs/tdb.php on line 10 Connection to database failed. Warning: odbc_errormsg(): supplied argument is not a valid ODBC-Link resource in /usr/local/apache/htdocs/tdb.php on line 14 preparing query Warning: odbc_prepare(): supplied argument is not a valid ODBC-Link resource in /usr/local/apache/htdocs/tdb.php on line 20 [EMAIL PROTECTED] htdocs]$ db2 "? CLI0150E" CLI0150E Driver not capable. Explanation: The operation is valid but not supported by either the driver or the data source. User Response: Specify a valid operation. [EMAIL PROTECTED] htdocs]$ Where is problem in odbc_connect, odbc_prepare or in my mind? HELP PLEASE! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22971&edit=1