From:             anton at esrr dot ru
Operating system: Linux RedHat 8
PHP version:      4.3.1
PHP Bug Type:     ODBC related
Bug description:  Error in odbc_prepare or in odbc_connect?

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 bug report at http://bugs.php.net/?id=22971&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22971&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22971&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22971&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22971&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22971&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22971&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22971&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22971&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22971&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22971&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22971&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22971&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22971&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22971&r=gnused

Reply via email to