error in Pear/DB
| From: | Vladimir | Date: | Mon, 02 Sep 2002 14:31:23 +0000 |
| Subject: | error in Pear/DB | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-8822@lists.php.net to get a copy of this message | ||
May be I found error in PEAR/DB
I use PEAR/DB to connect to Oracle database
I write an example to test this staff like this
<?php
require_once "DB.php";
$dsn=array(
"phptype"=>"oci8",
"hostspec"=>"localhost:1521",
"database"=>"cool",
"username"=>"user",
"password"=>"pass"
);
$db=DB::connect($dsn);
if (DB::isError($db))
echo $db->getMessage()."\n";
else
echo "Ok\n";
?>
But I have "DB Error: connect failed"
Then I looked up source code DB/oci8.php
In connect method I found following string
if ($hostspec) {
$conn = @$connect_function($user,$pw,$hostspec);
there connect_function is OCILogon or OCIPLogon or OCINLogon
But third parameter of OCI.Logon is database name not hostspec
I replaced that code with this
$datab=$dsninfo["database"];
if (isset($datab)) {
$conn = @$connect_function($user,$pw,$datab);
And my example said Ok