Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
oracle 10g and pear

oracle 10g and pear

2006-04-13       - By Mladen Gogala

Reply:     1     2  


On 04/12/2006 11:25:50 AM, Simone Saravalli wrote:
> hi to everybody,
>    I use Oracle 10g Express and I'm dealing with the connection to the
> database in php through the use of pear. In order to connect to the
> database I use the function DB::connect() provided by the pear
> package, but google told me that the connection is allowed only up to
> oracle version 9. With the oci_connect() function always goes right,
> so I suspect there's something wrong in pear. Someone else has the
> same experience?
>
> Thanks in advance, Simone Saravalli

PEAR::DB is a little bit outdated and a little bit slow, but other then that,
there is nothing wrong with it. It can connect to Oracle 10G, both R1 & R2
because
it uses the underlying OCI8 driver, which can connect to Oracle 10g. The only
quirk is that with 10.2, the protection of some directories ($ORACLE_HOME/lib,
$ORACLE_HOME/network/admin, $ORACLE_HOME/nls) are wrong and needs to be fixed.
Fortunately, the latest patchset contains script $ORACLE_HOME/install
/changePerm.sh
which will fix the protection bits. My advice nevertheless is to use ADOdb
instead.
It is faster, it supports exceptions, it is extremely convenient and it is well
maintained, with newer releases appearing much more frequently then with PEAR:
:DB.
ADOdb can be found at http://adodb.sourceforge.net


Here is a little PHP script used for testing:
#!/usr/local/bin/php

<?php
require_once('DB.php');
$DSN="oci8://scott:tiger@(protected)";
$db=DB::connect($DSN);
if (DB::iserror($db)) {
  die($db->getUserInfo());
}
$db->autoCommit(FALSE);
$sql="select * from dept";
$sth=$db->query($sql);
if (DB::iserror($sth)) {
  die($sth->getUserInfo());
}
$cols=$db->tableInfo($sth);
echo "This result has ",count($cols)," columns\n";

foreach ($cols as &$col) {
   echo $col['name'],"\t";
}
echo "\n";
while ($sth->fetchinto($row)) {
     foreach ($row as &$val) {
             print "$val\t";
     }
     echo "\n";
}      
$tst=$db->prepare("delete from non_existing_table");
if (DB::isError($tst)) {
  die($tst->getDebugInfo());
}
print "Kilroy was here!\n";
$tst1=$db->execute($tst);
if (DB::isError($tst1)) {
  die($tst1->getDebugInfo());
}

?>


The output of the script is:

$ ./simone.php

This result has 3 columns
DEPTNO  DNAME   LOC
10      ACCOUNTING      NEW YORK
20      RESEARCH        DALLAS
30      SALES   CHICAGO
40      OPERATIONS      BOSTON
Kilroy was here!
delete from non_existing_table [nativecode=ORA-00942 (See ORA-00942.ora-code.com): table or view does not
exist]

The "Kilroy" part was inserted for me to see when will the latest PEAR perform
parse operation. As it turns out, it does deferred parse, bundled with the
"execute",
as expected. This is what I have:

Installed packages, channel pear.php.net:
=========================================
Package         Version State
Archive_Tar     1.3.1   stable
Config          1.10.6  stable
Console_Getargs 1.3.1   stable
Console_Getopt  1.2     stable
DB              1.7.6   stable
Date            1.4.6   stable
HTML_Common     1.2.2   stable
HTML_Form       1.3.0   stable
HTML_Table      1.6.1   stable
Log             1.9.3   stable
PEAR            1.4.9   stable
PHP_Beautifier  0.1.8   beta
Var_Dump        1.0.3   stable
XML_Parser      1.2.7   stable
XML_RPC         1.4.7   stable
XML_Util        1.1.1   stable
$

--
Mladen Gogala
http://www.mgogala.com

--
http://www.freelists.org/webpage/oracle-l