php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9662 odbc_connect() can't create new connection if same credentials are given again
Submitted: 2001-03-09 13:44 UTC Modified: 2017-01-29 04:22 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: cpoirier at shelluser dot net Assigned:
Status: No Feedback Package: ODBC related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cpoirier at shelluser dot net
New email:
PHP Version: OS:

 

 [2001-03-09 13:44 UTC] cpoirier at shelluser dot net
I think this may be intentional -- there was a comment that could have been to that effect in the code.  However, it has the side effect of breaking transaction management.  The code here is an approximation of the results that I was seeing -- I don't guarantee it will run, but you'll get the idea...

<?php
 
  $connection1 = odbc_connect( "X", "", "" );
  $connection2 = odbc_connect( "X", "", "" );

  odbc_exec( $connection1, "insert into Table values (1) );
  odbc_exec( $connection2, "insert into Table values (2) );

  odbc_commit( $connection1 );
  odbc_rollback( $connection2 ); 

  odbc_close( $connection1 );
  odbc_close( $connection2 );
?>

Table contains rows:
  1
  2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-09 16:12 UTC] kalowsky@php.net
Well this is true.  The connection option should have an option to create/force a new connection really, but it doesn't.  Currently if you make two connections with the same information, you'll only receive the handle back of the first connection (to save on the connection pooling).  Makes sense in 99% of cases... but you should also be using a "start transaction" and "end transaction" statement in sql to ensure transaction management, and that would be based upon a SQL statement, not a connection handle.  

Not sure if I'd really classify this as a bug, but I'll leave it open because it would be a nice to change the behavior of.  
 [2002-06-09 16:21 UTC] mfischer@php.net
Updated summery, version, OS, making a feature request, reopening.

Mysql is the only extension having this. It would be very nice if before 4.3 gets release we have this for *every* db extension finally . . .
 [2010-11-24 08:56 UTC] jani@php.net
-Package: Feature/Change Request +Package: ODBC related -Operating System: Windows +Operating System: * -PHP Version: CVS +PHP Version: *
 [2017-01-20 17:02 UTC] heiglandreas@php.net
-Status: Open +Status: Feedback
 [2017-01-20 17:02 UTC] heiglandreas@php.net
Is still relevant?
 [2017-01-29 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 05:01:27 2024 UTC