Jump to content


Photo

Oracle Persistent Connection


  • Please log in to reply
No replies to this topic

#1 wesso

wesso
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 06 September 2005 - 09:10 AM

Hi
I have recently configured php4 and Apache to works fine with Oracle 10g database on windows.

The oracle 10g does have Apache and PHP modules built in. And all work fine.

I have tried to use (ociplogon) instead of (OCILogon) and it works fine by establishing many child process connections.
But they will run for ever..

Is there any way to kill the child processes after a defined timeout or for example to kill the process that has been inactive for while.

(PS: why having many connections to the database that is not been used for while)

If there is no function in PHP to do that, can you so please help with a script code to do that.

Here is how my simple php script looks like:

-----------------------------------------------------------------------------

<?php

$db_conn = ociplogon( "king", "camilla", "PROD" );

$cmdstr = "select FIRSTNAME, LASTNAME from person where ID BETWEEN 14106 AND 14125";

$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);

$nrows = ocifetchstatement($parsed, $results);


echo "<html><head><title>Oracle PHP Test</title></head><body>";
echo "<center><h2>Oracle PHP Test</h2><br>";
echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";
echo "<td><b>Name</b></td>\n<td><b>Salary</b></td>\n</tr>\n";

for ($i = 0; $i < $nrows; $i++ )
{
echo "<tr>\n";
echo "<td>" . $results["FIRSTNAME"][$i] . "</td>";
echo "<td>" . $results["LASTNAME"][$i] . "</td>";
//echo "<td>$ " . number_format($results["PERSONMASTER_ID"][$i], 2). "</td>";
echo "</tr>\n";
}

echo "<tr><td colspan='2'> Number of Rows: <B>$nrows</B></td></tr></table>";
echo "<br><em>Tillykke Wessam!</em><br></center></body></html>\n";

ocilogoff($db_conn);

?>

-----------------------------------------------------------------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users