php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9982 odbc_tables fails without closing previous database
Submitted: 2001-03-25 22:42 UTC Modified: 2001-06-01 23:11 UTC
From: badams at ingenico dot com dot au Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4 OS: winnt4 sp 6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: badams at ingenico dot com dot au
New email:
PHP Version: OS:

 

 [2001-03-25 22:42 UTC] badams at ingenico dot com dot au
If calling odbc_tables in a loop the database connection must be closed before callign odbc_tables again. 

Error
Exception: access violation 0xc0000005)

eg

This FAILS
for($i=0; $i<sizeof($dbname); $i++)
{
  $conn = odbc_conn($dbname[$i], $name, $pword);
  $res = odbc_tables($conn);
  $n = 1;
  while( odbc_fetch_row($res, $n))
  {
     ...
  }
}
odbc_close_all( );

Yet this works fine
for($i=0; $i<sizeof($dbname); $i++)
{
  $conn = odbc_conn($dbname[$i], $name, $pword);
  $res = odbc_tables($conn);
  $i = 1;
  while( odbc_fetch_row($res, $i))
  {
     ...
  }
  odbc_close_all( );
}

Thanks in advance...





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-16 22:50 UTC] kalowsky@php.net
what is $dbname, and is it possible you've run out of available ODBC connections with your first example?  you are opening up N number of OBDC connections...

and finally does this still exist in the current 4.0.5 or even 4.0.4pl1 releases?
 [2001-04-16 23:15 UTC] badams at ingenico dot com dot au
$dbname is an array of ODBC data sources.
The number of ODBC connections isn't an issue. It fails on the second call to odbc_tables. The only way to stop the error is to close all connections and open again before called odbc_tables.

This fails on php4.0.4 but I do not have 4.0.5 yet.
thanks


 [2001-06-01 23:11 UTC] kalowsky@php.net
looks like this is fixed in the CVS as I cannot reproduce this using Win98SE... at least I don't get an error exception...  do try 4.0.5, or one of the 4.0.6 RC's... if it continues for you please re-open the bug.
 [2011-08-30 20:30 UTC] yago@php.net
Automatic comment from SVN on behalf of yago
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=315817
Log: Approved change made by anonymous #9982
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 14:01:30 2025 UTC