Re: [PHP4BETA] Oracle Session Problems (more)
| From: | Sergio Garcia Murillo | Date: | Fri, 05 May 2000 08:30:16 +0000 |
| Subject: | Re: [PHP4BETA] Oracle Session Problems (more) | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14511@lists.php.net to get a copy of this message | ||
> On Thu, May 04, 2000 at 07:35:53PM +0200, Sergio Garcia Murillo wrote:
> > I changed the way was doing the connection, and uses non persistent
connection,
> > and again after i while i got this message in the log every time i
execute a script that
> > connect to the DB
> >
> > PHP Warning: _oci_close_session: OCISessionEnd: Error while trying to
retrieve text for error ORA-12571 in Unknown on line 0
> 12571, 00000, "TNS:packet writer failure"
> // *Cause: An error occurred during a data send.
> // *Action: Not normally visible to the user. For further
> // details, turn
> // on tracing and reexecute the operation. If error persists,
> // contact
> // Oracle Customer Support.
>
> if you could create a 10-50 line testscript that reproduces your
> problem when you hit the server really hard (eg using
> httpload) than we can have a look at it.
Well here is db class i use in all my connections... (The only important
ones are execute and query)
---------------------------db.inc-------------------
<?
class DeporDb {
var $user;
var $pwd;
var $db;
var $conn;
var $stmt;
var $result;
var $count;
var $numrows;
var $mode;
function DeporDb ($user,$pwd,$db)
{
$this->user=$user;
$this->pwd=$pwd;
$this->db=$db;
$this->AutoCommit(true);
$this->result=array();
}
function execute($query)
{
if (!$this->conn)
{
$this->conn=@OCILogon($this->usuario,$this->clave,$this->db);
}
if ($this->error_array=OCIError())
{
error_log($this->error_string()."".str_replace("\t","
",$query)."\n",0);
return false;
}
$this->stmt=@OCIParse($this->conn,$query);
if ($this->error_array=OCIError($this->stmt))
{
error_log($this->error_string()."".str_replace("\t","
",$query)."\n",0);
return false;
}
$num=@OCIExecute($this->stmt,$this->mode);
if ($this->error_array=OCIError($this->stmt))
{
error_log($this->error_string()."".str_replace("\t","
",$query)."\n",0);
return false;
}
return $num;
}
function query ($query)
{
if(!$this->execute($query))
return false;
$this->numrows=OCIFetchStatement($this->stmt,$this->result);
if (@OCIError($this->stmt))
{
eror_log($this->error_string()."".str_replace("\t","
",$query)."\n",0);
return false;
}
$this->count=0;
return $this->numrows;
}
function next()
{
if($this->count<$this->numrows)
$this->count++;
else
return false;
return true;
}
function f($key)
{
return $this->result[strtoupper($key)][$this->count-1];
}
function c($key)
{
return $this->result[strtoupper($key)];
}
function error ()
{
return $this->error_array["code"];
}
function error_string()
{
return $this->error_array["message"];
}
function AutoCommit($flag)
{
if (!$flag)
$this->mode=OCI_DEFAULT;
else
$this->mode=OCI_COMMIT_ON_SUCCESS;
}
function commit()
{
return OCICommit($this->conn);
}
function rollback()
{
return OCIRollback($this->conn);
}
}
?>
And now the simple script
---------------simple.php---------------
<?
include ('db.inc');
$db= new DeporDb('foo','foo','tierra');
$db->query('select res_local from encuentros where res_local=0');
while ($db->next())
{
echo $db->f("res_local");
}
?>
The script executes and show the output but in the error log appears...
PHP Warning: _oci_close_session: OCISessionEnd: Error while trying to
retrieve text for error ORA-12571 in Unknown on line 0
And if i change the OCILogon to OCIPLogon it starts working fine for a while
but then i get the same error
again followed by an ORA 1041, we are in contact with the Oracle support so
if we get some answer i'll let
you now...
Sergio