php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31898 OCI8: Already reproducable Bug #20006 cannot use 2 database connections
Submitted: 2005-02-09 15:45 UTC Modified: 2006-04-03 10:05 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: buhmann at teqneers dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.10 OS: WIN2k/Win2003/XP
Private report: No CVE-ID: None
 [2005-02-09 15:45 UTC] buhmann at teqneers dot de
Description:
------------
I have to fight with the same problem up to the current release (4.9.10). It doesn't seems to be fixed. In my opinion adding more tnsnames to the oracle client isn't help enough. the oracle user have to be enough.

I tried it on a win2k and win2003 server edition with oracle clients 8 and 9. always the same problem. opening the first connection works fine. also doing some selects with this connection. but, after opening a second connection and don't use it immediately, errors occurred. if i instead use the second connection immediately (doing a select or anything), it will also works correct. The errors will occurr (using the first connection) until i will use the second connection.

Reproduce code:
---------------
<?php
	/* 
	   test table 1, created on the first schema 'SCHEMA_1'
	   ----------------------------
	   create table test1 ( 
	   dummy NUMBER(20) NOT NULL
	  			 );  
	   commit;
	   ----------------------------
	   
	   test table 2, created on the second schema 'SCHEMA_2'
	   ----------------------------
	   create table test2 ( 
	   dummy NUMBER(20) NOT NULL
	  			 ); 
	   commit;
	   ----------------------------
	*/

	function selectOne() { 
		global $connectionOne;
		
		$select 	= 'SELECT * FROM test1';
		$stmt		= OCIPARSE( $connectionOne, $select );
		OCIExecute( $stmt );
		OCIFetchInto( $stmt, $arr, OCI_ASSOC );
		OCIFreeStatement( $stmt );     
	}
	
	function selectTwo() { 
		global $connectionTwo;
		
		$select 	= 'SELECT * FROM test2';
		$stmt		= OCIPARSE( $connectionTwo, $select );
		OCIExecute( $stmt );
		OCIFetchInto( $stmt, $arr, OCI_ASSOC );
		OCIFreeStatement( $stmt );     
	}
	
	
	// make first connection
	$connectionOne = OCILogon( 'user1', 'pwd1', 'TNS' );
	
	
	// select again from table test1 (connection 1)
	echo '
	Start----- Test1 Con1 -----------------------<br />';
		selectOne();
	echo '
	End-------------------------------------------
	<br />
	<br />
	<br />';
	
	
	// make second connection
	$connectionTwo = OCILogon( 'user2', 'pwd2', 'TNS' );
	
	
	// select again from table test1 (connection 1), this will result in an error
	echo '
	Start----- Test1 Con1 -----------------------<br />';
		selectOne();
// ===> if you will make a selectTwo() instead off a
// ===> selectOne() at this point, now errors occurr!
		//selectTwo();
	echo '
	End-------------------------------------------
	<br />
	<br />
	<br />';
	
	
	
	
	
	// select from table test1 (connection 1)
	echo '
	Start----- Test1 Con1 -----------------------<br />';
		selectOne();
	echo '
	End-------------------------------------------
	<br />
	<br />
	<br />';
	
	
	// select from table test2 (connection 2)
	echo '
	Start----- Test2 Con2 -----------------------<br />';
		selectTwo();
	echo '
	End-------------------------------------------
	<br />
	<br />
	<br />';
	
	
	// select again from table test1 (connection 1), this will work now
	echo '
	Start----- Test1 Con1 -----------------------<br />';
		selectOne();
	echo '
	End-------------------------------------------
	<br />
	<br />
	<br />';
?>


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-01 11:00 UTC] buhmann at teqneers dot de
Is anybody in here, which is responsible for this or can make a conclusion to this???
 [2005-04-15 14:02 UTC] buhmann at teqneers dot de
again one month later, nothing happens :-(
 [2006-04-03 10:05 UTC] tony2001@php.net
Should be fixed since OCI8 1.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 15:01:28 2024 UTC