PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB » Bug #590

Oracle-specific error message text is not available in MDB

Details

Submitted2004-01-16 07:01 UTC
Fromcjbj at hotmail dot com
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.4
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2004-01-16 07:01 UTC] cjbj at hotmail dot com

Description:
------------
Oracle-specific error message text is not available in PEAR MDB. It
is accessible in PEAR DB. For example connection errors do not
pinpoint the specific Oracle OCI8 problem.

I tested:
PHP 4.3.5RC1, Windows 2000, Apache 1.3.28
DB 1.5.0RC2 stable
MDB 1.2 stable

Reproduce code:
---------------
<?php

// Basic, raw, query using MDB

define("UN", "scott");
define("PW", "tiger_wrong_pw");
define("DB", "MYDB");

require("MDB.php");

$mdb = MDB::connect('oci8://'.UN.':'.PW.'@'.DB);

if (MDB::isError($mdb)) {
echo "<pre>";
echo "getMessage: ".$mdb->getMessage()."\n";
echo "getUserInfo: ".$mdb->getUserInfo()."\n";
echo "getDebugInfo: ".$mdb->getDebugInfo()."\n";
echo "</pre>";
die;
}

echo "Connected as ".UN."@".DB."<br>\n";

$result = $mdb->query("SELECT * FROM DUAL");

if (MDB::isError($result)) {
die ($result->getMessage());
}

while ($row = $mdb->fetchInto($result)) {
foreach ($row as $item) {
echo $item." ";
}
echo "<br>\n";
}

$mdb->freeResult($result);
?>

Expected result:
----------------
Changing all occurences of MDB to DB and running the script gives:

getMessage: DB Error: connect failed
getUserInfo: [nativecode=ORA-01017: invalid username/password; logon denied
] ** oci8://scott:tiger2@MYDB
getDebugInfo: [nativecode=ORA-01017: invalid username/password; logon denied
] ** oci8://scott:tiger2@MYDB

While not perfect, at the least the Oracle error is shown.

Actual result:
--------------
Running the MDB testcase with an invalid username/password gives:

getMessage: MDB Error: unknown error
getUserInfo: oci8://scott:tiger2@MYDB/
getDebugInfo: oci8://scott:tiger2@MYDB/