#3723 [Opn]: Cross-nested connect/close fails

From: Date: Tue, 01 Oct 2002 20:21:28 +0000
Subject: #3723 [Opn]: Cross-nested connect/close fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-21134@lists.php.net to get a copy of this message
ID: 3723 Updated by: hholzgra@php.net Reported By: sdelmont@loquesea.com Status: Open Bug Type: ODBC related Operating System: Win2000 Pro -PHP Version: 3.0.15 +PHP Version: 4.3.0-dev New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#21134) next »