ID:               3723
 Comment by:       RMartins at pt dot xrt dot com
 Reported By:      sdelmont at loquesea dot com
 Status:           Closed
 Bug Type:         ODBC related
 Operating System: Win2000 Pro
 PHP Version:      4.3.0-dev
 New Comment:

At least, a counter should be added, so that if you call open 4 times
(same DSN) then only after 4th close call should the connection
actually be released.


Previous Comments:
------------------------------------------------------------------------

[2002-10-02 12:13:24] [EMAIL PROTECTED]

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).

------------------------------------------------------------------------

[2002-10-01 15:21:27] [EMAIL PROTECTED]

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 at loquesea dot 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

Reply via email to