|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-03-16 00:37 UTC] miwai at sumitem dot co dot jp
Description: ------------ Now I'm developing Web Application using PHP5.2 and DB2 V8.2. I created database access object by PDO_ODBC first. Then I modified it by PDO_IBM(1.1.0). One day I found execute method of PDO_IBM didn't throw a specified exception. It thrown exception of statement error. But It didn't throw exception of result of excecute. - insert or update and so on - When I tried to execute insert statement on DB2 Command Center it thrown an exception. Then I changed driver PDO_ODBC from PDO_IBM it thrown same exception. But only PDO_IBM didn't throw it. SQLSTATE[23505]: Unique violation: -803 [IBM][CLI Driver][DB2/LINUX] SQL0803N "1" .... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 13:00:01 2025 UTC |
This is sample program. Could you try it? Program: print('This is PDO_ODBC.<br>'); $con = new PDO('odbc:dbname','user','password'); print('This is PDO_IBM.<br>'); $con = new PDO('ibm:DSN=dbname','user','password'); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); print('beginTran<br>'); $con->beginTransaction(); $stmt = $con->prepare("insert into TEST (TEST_ID, TEST_NM ) values (?, ?)"); try { print('execute<br>'); $res = $stmt->execute(array(1,'a')); if($res){ print('commit<br>'); $con->commit(); } else { $err = $stmt->errorInfo(); print('execute failed<br>'); print($err[0].'<br>'); print($err[1].'<br>'); print($err[2].'<br>'); $con->rollBack(); } } catch(Exception $e) { $err = $stmt->errorInfo(); print('exception occured<br>'); print($err[0].'<br>'); print($err[1].'<br>'); print($err[2].'<br>'); $con->rollBack(); } Result of PDO_ODBC. This is PDO_ODBC. beginTran execute exception occured 23505 -803 [IBM][CLI Driver][DB2/LINUX] SQL0803N "1" ~Japanese message~ SQLSTATE=23505 (SQLExecute[-803] at /usr/local/src/php-5.2.0/ext/pdo_odbc/odbc_stmt.c:133) Result of PDO_IBM This is PDO_IBM. beginTran execute execute failed 00000 0 (SQLExecute[0] at /usr/local/src/php-5.2.0/ext/pdo_ibm/ibm_statement.c:717)