|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-02-28 08:33 UTC] jean-francois dot gosset at telintrans dot fr
With the following test (test_oci8.php) both connexions (USER_1 and USER_2) are persistant.
Notes :
1. We can see that connexions are persistant with the following SQL command :
select username, status, logon_time from v$session where username='USER_1' or username='USER_2';
2. We can use the following workaround : use a different database name for USER_1 and USER_2 (who acces the same real database).
3. If we invert the order of connexions (USER_2 before USER_1) and use OCInlogon for USER_1, only USER_2 has persistant connexions but the number of connexions of USER_2 increase until to reach the maximum limit (ORA-00604 error).
-------------------------------
test_oci8.php
-------------------------------
<html>
<title>OCI8 bug test</title>
</head>
<body>
<%
$user = "USER_1";
$password = "pwd1";
$database = "TEST";
{
// should be non persistent !!!!
$connexion = OCIlogon (
$user,
$password,
$database);
if (!$connexion)
{
trigger_error (
"Erreur OCIlogon $user / $database",
E_USER_ERROR);
}
else
{
echo "<p>Connexion 1 OK";
}
OCIlogoff ($connexion);
}
{
$user = "USER_2";
$password = "pwd2";
$database = "TEST";
// If we use a different databasename (for the same real database) we don't have the problem
// $database = "TEST2";
$connexion = OCIplogon (
$user,
$password,
$database);
if (!$connexion)
{
trigger_error (
"Erreur OCIplogon $user / $database",
E_USER_ERROR);
}
else
{
echo "<p>Connexion 2 OK";
}
OCIlogoff ($connexion);
}
%>
</body>
</html>
-------------------------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 16:00:02 2025 UTC |
OCIPlogon() will do the same as OCILogon() but mark the sever and session handle as persistent, which means that PHP won't close them on script-end. if your script does a OCILogon("s","t") and later a OCIPLogon("s","t") _no_ new server or session handle will be created but instead the existing ones will be marked persistent. this is intended behaviour - why would we want to change it?The behaviour is correct for the case when you call OCILogon('u1','p1') and OCIPLogon('u1','p1') (with the same user), but incorrect when you call OCILogon('u1','p1') and OCIPlogon('u2','p2'). The latter case creates two sessions (that's correct - can't be shared, because two different users are logging in), but both sessions are made persistent. This happens even if OCIPlogon and OCILogon are not called within one script but handled by the same process. Maybe the problem is in the reusing of persistent server connections (where usernames are not involved).