PHP5RC2 and PEAR DB Problem

This is a discussion on PHP5RC2 and PEAR DB Problem within the PHP Language forums, part of the PHP Programming Forums category; With PHP5RC2, DB::connect() is not returning the correct type of object. #!/usr/local/bin/php <?php require_once("...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-03-2004
Derek Battams
 
Posts: n/a
Default PHP5RC2 and PEAR DB Problem

With PHP5RC2, DB::connect() is not returning the correct type of object.

#!/usr/local/bin/php
<?php
require_once("DB.php");

$dsn = "odbc://db2inst1:badpasswd@testdb";
$db = DB::connect($dsn);
echo $db->getMessage();
if(DB::isError($db))
echo "Connect failed!";
else
{
$res = $db->query("SELECT * FROM test_tbl");
while($row = $res->fetchRow())
echo $row[0] . "\n";
$db->disconnect();
}
?>

The password in the DSN is wrong and DB2 reports the error, however
DB::connect() still returns an object of type DB_odbc. I've traced
connect() in DB/odbc.php and confirmed that it recognized that
odbc_connect() failed and goes into that code path and creates a DB_error
object and I've even printed out the type of the object inside the function
before it returns it, but in the caller (my test script above), the reported
type is DB_odbc and so the if statement is false and then it tried to run
the query, but then I get a series of odbc_*() errors because there's no
valid resource for those functions to operate on. Has anyone been able to
use PEAR DB, specifically the ODBC driver, with PHP5RC2? The code above
works on another system, as expected, with PHP 4.3.6.

Thanks,

Derek


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:30 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0