#3723 [Opn->Csd]: Cross-nested connect/close fails
| From: | kalowsky@php.net | Date: | Wed, 02 Oct 2002 17:13:24 +0000 |
| Subject: | #3723 [Opn->Csd]: Cross-nested connect/close fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21306@lists.php.net to get a copy of this message | ||
ID: 3723
Updated by: kalowsky@php.net
Reported By: sdelmont@loquesea.com
-Status: Open
+Status: Closed
Bug Type: ODBC related
Operating System: Win2000 Pro
PHP Version: 4.3.0-dev
New Comment:
Hartmut the suggested feature exists in new odbc code, but won't ever
been seen in the ODBCv2 code. Having multiple optional variables won't
happen... the code becomes too confusing then.
The code itself is fine, the behavior you're seeing is what is
expected. Hartmut explained this rather nicely. One simple solution
to doing this is to use different usernames or passwords which will
cause the asked for behavior.
This behavior actually falls inline with the way ODBC is expected to
work (handles method etc).
Previous Comments:
------------------------------------------------------------------------
[2002-10-01 15:21:27] hholzgra@php.net
connection handles are reused when connecting with same dsn
instead of opening a new connection, so close will close the connection
for both connects
there should be an optional force_new parameter or flag
like with mysql_connect
changed to feature request
------------------------------------------------------------------------
[2000-03-03 19:59:14] sdelmont@loquesea.com
Cross-nested connections to the same ODBC Source fails.
It seems the first odbc_close() closes all other connections to the
same DSN.
This works OK... (Correctly nested)
$A = odbc_connect( DSN );
$B = odbc_connect( DSN );
odbc_exec( $A );
odbc_exec( $B );
odbc_close( $B );
odbc_close( $A );
This works OK... (Non nested)
$A = odbc_connect( DSN );
odbc_exec( $A );
odbc_close( $A );
$B = odbc_connect( DSN );
odbc_exec( $B );
odbc_close( $B );
This works FAILS... (Cross-nested)
$A = odbc_connect( DSN );
$B = odbc_connect( DSN );
odbc_exec( $A );
odbc_close( $A );
odbc_exec( $B );
odbc_close( $B );
Warning: Bad ODBC connection number (1) in xxxx.php on line [line
number for 'odbc_exec( $B );']
Using different DSNs works... even if the two DSNs point to the same
database.
I tested it using PHP 3.0.15 and 4 beta 4, using JET (Access) and
MSSQL.
This is a serious problem if you use ODBC for PHPLIB, which doesn't
close its connections, and use the same DSN elsewhere on your code.
The only workaround seems to either use a separate DSN for PHPLIB and
other queries, or change PHPLIB so it closes the database connections
after page_open and reopens it at page_close
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=3723&edit=1