PEAR::DB with oracle
| From: | Abe Music | Date: | Tue, 22 Jul 2003 15:22:56 +0000 |
| Subject: | PEAR::DB with oracle | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6783@lists.php.net to get a copy of this message | ||
Hi,
I've been using DB for awhile now and it's always been with mysql. Now, I
have branched out and I am now using DB to connect to our university's
major databases as well as local mysql db's too. Our university has two
major db's that we use and I often make connections to both as well as a
mysql database.
Here's the code:
function db1_connect() {
$dsn = array (
'phptype' => 'oci8',
'username' => '********',
'password' => '********',
'hostspec' => '********');
$options = array ('persistent' => TRUE, 'optimize' =>
'portability');
$dbh = DB::connect($dsn,$options);
return $dbh;
}
function displayDeptSelect($select_name, $conn, $form_name, $class="sleek")
{
$sql = "SELECT DISTINCT SSBSECT_SUBJ_CODE FROM SSBSECT";
$results = $conn->getCol($sql);
$t_select = "<select name='$select_name'
id='$class'>\n";
$t_select .= "<option value=>Choose one</option>\n";
foreach($results as $k)
$t_select .= "<option value='$k'>$k</option>\n";
$t_select .= "</select>\n";
return $t_select;
}
Now, as you see it creates the code for a select box. This is what I get in
the select box (BUT not everytime).
/* start select */
1
1024
-1
DB Error: unkown error
SELECT DISTINCT SSBSECT_SUBJ_CODE FROM SSBSECT [nativecode=ORA-03113:
end-of-file on communication channel
/* end select */
I usually get this the first time loading the page after not viewing it for
more than five minutes or so, however, sometimes it will do it a couple
times in a row. The funny thing is if I refresh the page it usually 'fixes'
itself and everything works fine until I leave it alone for a bit.
Can anyone please help me? If I don't get this fixed I'm going to be forced
to move to another abstraction layer instead of DB to get my tools up and
running smoothly.
Thanks!