php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27696 ORA-24327 error
Submitted: 2004-03-25 10:33 UTC Modified: 2004-04-05 08:55 UTC
From: gioppo at csi dot it Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 4.3.2 OS: System Linux 2.2.19-6.2.1
Private report: No CVE-ID: None
 [2004-03-25 10:33 UTC] gioppo at csi dot it
Description:
------------
Making a connection using OCILogon in a webfar with 4 server against a single Oracle DB we get a ORA-24327 error but not everytime. Some time it connects sometimes not. It seems that it should have been correcte on CVS but apparently it doesn' any hint on how to solve this problem?
PHP API  20020918  
PHP Extension  20020429  
Zend Extension  20021010  
Thread Safety  disabled  
Apache Version  Apache/1.3.29  
Apache Release  10329100  
Apache API Version  19990320  
OCI8 Support  enabled  
Revision  $Revision: 1.183.2.5 $  
Oracle Version  8.1  


Reproduce code:
---------------
We use adodb


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-25 16:49 UTC] gioppo at csi dot it
Using ADODB project, istanciating this chunk of code:
$dbconn        = ADONewConnection($dbtype);
$dbh = $dbconn->Connect($dbhost, $dbuname, $dbpass,        $dbname);

This means that the code executed is:
$this->_connectionID = OCILogon($argUsername,$argPassword, $argDatabasename);
 [2004-03-25 16:59 UTC] gioppo at csi dot it
I've red the changelog between the 4.3.2 and the actual php version but it doesn't seems to have any mods on oci part.
I've red somewhere that the problem could be bacause on oci code could be called the session init before the attach.
Really do not understand it how expecially since in the situation where we have just 1 web server everithing goes well but with 4 behind a balancer we get the error.
No code change so really getting mad about it, any hint on where to look for more data is appreciated.
ORACLE_HOME is set, the tnsname is correct (otherwise we should never connect) going to look also on metalink for some other help.
 [2004-03-25 17:16 UTC] gioppo at csi dot it
Here is a note from oracle metalink

The errors ( ORA-24327, OCI-21560) may indicate OCI usage error 

if you are using OCI, can you verify if it's possible to physically connect to a server process or dispatcher ( for MTS-configured DB) via OCIServerAttach ... then try to authenticate one of more users via that connection to start one or more database sessions (via 
OCISessionBegin). 

IF OCIServerAttach fails and OCISessionBegin is invoked, you may get errors. 


According to OCI Programmer's guide (OCISessionBegin) 

For release 8.1 or later, OCISessionBegin() must be called for any given server handle before requests can be made against it. OCISessionBegin() only supports authenticating the user for access to the Oracle server specified by the server handle in the service context. In other words, after OCIServerAttach() is called to initialize a server handle, OCISessionBegin() must be called to authenticate the user for that given server.
 [2004-03-26 05:00 UTC] tony2001@php.net
Please, try latest stable PHP release.
And try latest PHP5 snapshot, there are a lot of changes since November.
I have no idea what code ADO uses to connect to Oracle, so please provide a short example with standard PHP functions, not wrapped with ADO or other wrapper.
 [2004-03-30 09:05 UTC] gioppo at csi dot it
We probably solved the problem bypassing tnsnames.ora.
We made the connection using tnsnames defined alias and it got errors sometime.
Here is a chunk of php code (we used method b which gave errors sometime, when we used d mode we always manage to make connection) any hint? A problem on finding tnsnames?
NOTE OCILogon is a php library function so no hint on how to modify it, but the behaviour meke me think about an environment problem:
we have a 
Compile-time ORACLE_HOME  /oracle_home  for compiling OCI for php
but
ORACLE_HOME  /oracle817/app/oracle/product/8.1.7  
_ENV["ORACLE_HOME"] /oracle817/app/oracle/product/8.1.7 
on env for apache and php (/oracle_home  is a symbolic link to the /oracle817/app/oracle/product/8.1.7 folder) could be that the OCI8 so compiled have trouble on traversing the link?

/*

  Multiple modes of connection are supported:
  
  a. Local Database
    $conn->Connect(false,'scott','tiger');
  
  b. From tnsnames.ora
    $conn->Connect(false,'scott','tiger',$tnsname); 
    $conn->Connect($tnsname,'scott','tiger'); 
  
  c. Server + service name
    $conn->Connect($serveraddress,'scott,'tiger',$service_name);
  
  d. Server + SID
  	$conn->connectSID = true;
	$conn->Connect($serveraddress,'scott,'tiger',$SID);


Example TNSName:
---------------
NATSOFT.DOMAIN =
  (DESCRIPTION =
	(ADDRESS_LIST =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = kermit)(PORT = 1523))
	)
	(CONNECT_DATA =
	  (SERVICE_NAME = natsoft.domain)
	)
  )
  
  There are 3 connection modes, 0 = non-persistent, 1 = persistent, 2 = force new connection
	
*/
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$mode=0)
{
       $this->_errorMsg = false;
       $this->_errorCode = false;
		
	if($argHostname) { // added by Jorma Tuomainen <jorma.tuomainen@ppoy.fi>
		if (empty($argDatabasename)) $argDatabasename = $argHostname;
		else {
			if(strpos($argHostname,":")) {
				$argHostinfo=explode(":",$argHostname);
			   	$argHostname=$argHostinfo[0];
				$argHostport=$argHostinfo[1];
		 	} else {
				$argHostport="1521";
   			}
				
			if ($this->connectSID) {
				$argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
				.")(PORT=$argHostport))(CONNECT_DATA=(SID=$argDatabasename)))";
			} else
				$argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
				.")(PORT=$argHostport))(CONNECT_DATA=(SERVICE_NAME=$argDatabasename)))";
			}
		}
				
		if ($mode==1) {
			$this->_connectionID = OCIPLogon($argUsername,$argPassword, $argDatabasename);
			if ($this->_connectionID && $this->autoRollback)  OCIrollback($this->_connectionID);
		} else if ($mode==2) {
			$this->_connectionID = OCINLogon($argUsername,$argPassword, $argDatabasename);
		} else {
			$this->_connectionID = OCILogon($argUsername,$argPassword, $argDatabasename);
		}
		if ($this->_connectionID === false) return false;
 [2004-03-30 10:03 UTC] tony2001@php.net
So, you've solved it, yes?
This piece of code didn't help me much, just because I can't test it.
 [2004-03-31 01:22 UTC] gioppo at csi dot it
Well I think that I've found a workaround.
To test it you can take the code from:
http://php.weblogs.com/adodb
and try a simple connection.
In any case you can try to see what happens if someone compile the php+OCI using a symbolic link for oracle_home and than uses an absolute oracle_home.
There could be a bug.
 [2004-03-31 02:12 UTC] tony2001@php.net
I can't reproduce it neither with PHP4, nor with PHP5.
Have you tried latest versions?
 [2004-03-31 03:41 UTC] gioppo at csi dot it
We cannot, it's a production environment and we cannot change version.
:-(
 [2004-03-31 03:45 UTC] tony2001@php.net
You can install new version in another directory and try it with PHP-CLI at least, there is no need to touch working installation.

 [2004-04-05 08:52 UTC] sniper@php.net
Assumed fixed in later versions. (tony2001: Just close these if you can't reproduce..)

 [2004-04-05 08:55 UTC] tony2001@php.net
ok.
I was just waiting for response.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 09:01:28 2024 UTC