MDB Error with OCI8 listTables
| From: | Vincent DUPONT | Date: | Fri, 01 Oct 2004 12:55:47 +0000 |
| Subject: | MDB Error with OCI8 listTables | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14709@lists.php.net to get a copy of this message | ||
HI,
The changelog of MDB indicates since 1.3.0 :
MDB_Manager_oci8:
- added listTables() and listTableFields()
So I updated my PEAR repository to get MDB 1.3.0
However, I tried the simple script below and it works with MySQL but not with OCI8 (oracle9i).
The query used in Manager_oci8 (SELECT table_name FROM sys.user_tables) works, so I don't
understand where does the MDB error come from.
Any help is welcome.
Vincent
<?php
require_once('MDB.php');
$dsn = "mysql://user:password@localhost/aw_system"; //This works with MySql
$dsn = "oci8://user:password@ORCL92"; //This generates an error
$conn = MDB::connect($dsn);
if(MDB::isError($conn)){
die("unable to connect to the DB");
}
$tables = $conn->listTables();
if(MDB::isError($tables)){
$output = "Class :".get_class($tables)."\n";
$output .= "Message :".$tables->getMessage()."\n";
$output .= "Code : ".$tables->getCode()."\n";
$output .= "Type : ".$tables->getType()."\n";
$output .= "Mode : ".$tables->getMode()."\n";
print_r($tables->getBacktrace());
die("Error While getting the tables.".$output);
}
echo "tables for <b>$dsn</b><p>";
for ($i=0; $i<sizeof($tables); $i++){
echo "<b><u>".$tables[$i]."</u></b><br>";
$fields = $conn->listTableFields($tables[$i]);
if(MDB::isError($fields)){
die("Error While getting the fields for table ".$tables[$i].".
".$fields->getMessage());
}
for($j=0; $j<sizeof($fields);$j++){
echo " ".$fields[$j]."<br>";
}
}
echo "<p>End...<p>";
$conn->disconnect();
?>