|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56340 Transactions not supported in PDO_ODBC
Submitted: 2005-03-05 16:27 UTC Modified: 2005-06-11 08:53 UTC
From: Assigned: wez (profile)
Status: Closed Package: PDO_ODBC (PECL)
PHP Version: 5_1 CVS-2005-03-05 (dev) OS: Linux (RHEL 4)
Private report: No CVE-ID: None
 [2005-03-05 16:27 UTC]
PDO_ODBC, connecting to a DB2 database, does not support PDO::beginTransaction() / PDO::rollBack().

I tested the same code against both PDO_ODBC and PDO_SQLITE, but only PDO_SQLITE handled the rollback correctly

The required functionality for transaction management in PDO_ODBC should be available in the ODBC 3.0 SQLEndTran() function - see for more details.

Unit test pdo_017 has been added to the ext/pdo/tests and ext/pdo_odbc/tests branches to track this functionality.

Reproduce code:
$conn = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');
//$conn = new PDO('sqlite:/home/daniels/bust');
$conn->exec('CREATE TABLE test (id INT)');
$conn->exec('INSERT INTO test(id) VALUES (1)');
$conn->exec('INSERT INTO test(id) VALUES (2)');
$conn->exec('INSERT INTO test(id) VALUES (3)');
function countRows($conn, $action) {
    $sql = "SELECT COUNT(*) FROM test";
    $stmt = $conn->query($sql);
    $num = $stmt->fetchSingle();
    return "Counted $num rows after $action.\n";
echo countRows($conn, 'insert');
$conn->exec('DELETE FROM test');
echo countRows($conn, 'delete');
echo countRows($conn, 'rollback');

Expected result:
Counted 3 rows after insert.
Counted 0 rows after delete.
Counted 3 rows after rollback.

Actual result:
Counted 3 rows after insert.
Counted 0 rows after delete.
Counted 0 rows after rollback.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-10 02:24 UTC]
Is this still the case with latest CVS of PDO and PDO_ODBC?
 [2005-06-11 08:53 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

Looks like the problem was that we weren't turning off auto-commit when a beginning a transaction.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 12:01:23 2021 UTC