php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38955 PDO DBLIB driver does not support transactions
Submitted: 2006-09-25 18:43 UTC Modified: 2011-05-07 19:11 UTC
Votes:10
Avg. Score:4.6 ± 0.5
Reproduced:9 of 10 (90.0%)
Same Version:3 (33.3%)
Same OS:8 (88.9%)
From: remery at seminolesheriff dot org Assigned: ssufficool (profile)
Status: Closed Package: *General Issues
PHP Version: 5.1.6 OS: Linux
Private report: No CVE-ID: None
 [2006-09-25 18:43 UTC] remery at seminolesheriff dot org
Description:
------------
I'm connecting from a Linux/Apache/PHP server to a Microsoft SQL Server 2000 database using PDO with the DBLIB driver. Attempting to use transactions produces the exception 'This driver doesn't support transactions'.

Reproduce code:
---------------
$dsn = 'dblib:host=' . $server . ';dbname=' . $dbName;
$user = 'tempUser';
$pwd = 'tmpPwd';
$table = 'sqlTable';
$column = 'colName';
$value = 'value';

$sql = 'Insert Into ' . $dbName;
$sql .= ' (' . $column . ')';
$sql .= ' Values ' . $value;

$conn = new PDO($dsn, $user, $pwd);
$conn->beginTransaction();
$conn->exec($sql);
$conn->commit();

Expected result:
----------------
The value should be inserted into the table.

Actual result:
--------------
Fatal error: Uncaught exception 'PDOException' with message 'This driver doesn't support transactions' in /var/www/html/business/entity.php:37 Stack trace: #0 /var/www/html/business/entity.php(37): PDO->beginTransaction() #1 {main} thrown in /var/www/html/business/entity.php on line 37

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-26 08:46 UTC] tony2001@php.net
No bug here, reclassified as feature request.
 [2010-06-21 09:30 UTC] ssufficool@php.net
Automatic comment from SVN on behalf of ssufficool
Revision: http://svn.php.net/viewvc/?view=revision&revision=300628
Log: Fix bug #38955 - add transaction support
 [2010-06-21 09:31 UTC] ssufficool@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: ssufficool
 [2010-06-21 09:31 UTC] ssufficool@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in revision 300628.
 [2010-06-21 09:32 UTC] ssufficool@php.net
Fixed in trunk.

revision 300628.
 [2011-04-29 22:36 UTC] urkle at outoforder dot cc
What is the timeline for this getting into an official 5.3 release?  

I have manually patched my version and can confirm it works on Mac OS X 10.6.6 running PHP 5.3.3. (though compiled PDO_DBLIB with this patch from the 5.3.5 release)
 [2011-04-30 17:48 UTC] ssufficool@php.net
The whole of the PDO DBLIB needs to me moved to a release. There are many fixes and features as well as new tests. I have lobbied for these changes several times, now it is up to the release manager.
 [2011-04-30 20:32 UTC] pajoye@php.net
I don't see why you could do releases via PECL as well. That will free you from 
the slower PHP release cycles.
 [2011-04-30 21:04 UTC] ssufficool@php.net
I do not see a practical way to PECL this because PDO is already core to PHP and marked depreciated in PECL.
 [2011-04-30 21:19 UTC] pajoye@php.net
It is marked as such because nobody cares about it. And before you came in, it 
should have marked as such in core as well.

Anyway, I do it for zip, enchant and planing to do so for more extensions as well. 
This is a very good way to provide more frequent releases to our users and 
especially to the distros.
 [2011-05-07 19:11 UTC] ssufficool@php.net
No developer cares about it, but plenty of users have and do care. 

I don't use PHP much anymore, but that may change. When it does, I will consider maintaining this in two different places. Until then, the patches are here and the currently working and tested module resides in svn trunk.
 [2011-09-17 14:58 UTC] vds dot jeroen at gmail dot com
Patch should be added to 5.3 branch
 [2012-03-10 09:02 UTC] programmer at finner dot de
Why is this bug closed? The error still persists! I use PHP 5.3.10, and would 
really need to have transactions, and cannot use another database engine. So, 
PLEASE!!!, fix this!
Thanks in advance.
 [2012-03-15 12:38 UTC] programmer at finner dot de
After trying PHP 5.4 (which is not yet recommended for production purposes on 
Debian), I found out, that this bug is obviously fixed, but the fix is not 
mentioned in the changelogs.
 [2013-05-28 17:53 UTC] mneyman at yesco dot com
Yes, this bug is fixed in 5.4, but because of this bug: 
https://bugs.php.net/bug.php?id=64522, I am unable to upgrade.  Ideally, 64522 
gets fixed, but if not, it'd be great to have in a 5.3 branch as well.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 20 00:03:34 2022 UTC