php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #27932 odbc_free_result cause warning when work with 2 connection
Submitted: 2004-04-09 09:43 UTC Modified: 2006-01-17 17:20 UTC
From: shagren at ua dot fm Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.4 OS: Win98
Private report: No CVE-ID: None
 [2004-04-09 09:43 UTC] shagren at ua dot fm
Description:
------------
I use 2 odbc connection to ms-access database.
When i close second connection, i cannot free result from first connection - php show warning.

And first and second connections have identical resource id.

Reproduce code:
---------------
<?php
error_reporting(E_ALL);

//make 2 connection(ms-access database)
$conn1 = odbc_connect("test_access", "", "");
$conn2 = odbc_connect("test_access", "", "");

//echo connection id
echo "Connection1: $conn1 \nConnection2: $conn2\n";

//exec query
$result = odbc_exec($conn1, "select count(*) from temp_table");

//close connection2
odbc_close($conn2);

//free result from connection1
odbc_free_result($result);
?>

Expected result:
----------------
Connection1: Resource id #1
Connection2: Resource id #2


Actual result:
--------------
Connection1: Resource id #1
Connection2: Resource id #1
PHP Warning:  odbc_free_result(): 2 is not a valid ODBC result resource in C:\Temp\test3.php on line 18


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-09 11:32 UTC] sniper@php.net
From php_odbc.c:

" * We do have to hash non-persistent connections, and reuse connections.
 * In the case where two connects were being made, without closing the first
 * connect, access violations were occuring.  This is because some of the
 * "globals" in this module should actualy be per-connection variables.  I
 * simply fixed things to get them working for now.  Shane
"

This has been in it since 1999. (manual says you can have multiple connections and that is true as long as they either use different db or different credentials.)

 [2004-04-10 06:50 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2006-01-17 16:23 UTC] shagren at ua dot fm
I cannot find this info at http://www.php.net/manual/en/function.odbc-connect.php
 [2006-01-17 17:20 UTC] vrana@php.net
It's there: "You can have multiple connections open at once as long as they either use different db or different credentials."
 [2020-02-07 06:12 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=6ab4f62f5c902dc46f722495ef2782a596fb0c2f
Log: fix #27932 multiple open connections
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 03:01:31 2025 UTC