pdo and firebird connection
| From: | Michael Maier | Date: | Sat, 12 Mar 2005 15:46:47 +0000 |
| Subject: | pdo and firebird connection | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-2149@lists.php.net to get a copy of this message | ||
Hi,
I´ve trying now for hours just to connect with PDO to my firebird DB.
I tried it first with a mysql db and had no problems at all. but it doesn´t work with firebird and I don´t know why (haven´t found anything helpful via google as well).
I tried to use the manual from here:
http://de3.php.net/manual/de/function.pdo-construct.php
with the code below, I get always the error message:
Fatal error: Call to a member function getAttribute() on a non-object in K:\_workspace\test1\pdo3.php on line 7
a test with the interbase driver works well (see in the code comments).
=> is the code correct?
=> where is the error!?
=> does the PDO firebird driver work?
thx a lot for help,
Michael
<?php
$username = 'SYSDBA';
$password = 'xxxxxx';
$dbh = new PDO( 'firebird:User=SYSDBA;Password=xxxxxx;Database=k:\_firebird\examples\EMPLOYEE.FDB;DataSource=localhost;Port=3050', $username, $password );
//$dbh = new PDO( 'firebird:User=SYSDBA;Password=xxxxxx;Database=k:\_firebird\examples\EMPLOYEE.FDB;DataSource=localhost;Port=3050' );
print $dbh->getAttribute(PDO_ATTR_AUTOCOMMIT); // <==Fatal error here!
$stmt = $dbh->prepare("Select * from SHOW_LANGS('SRep',4,'Italy')");
$stmt->execute();
$stmt = null;
/*
// test with ibase driver
$dsn = 'localhost:k:\_firebird\examples\employee.fdb';
$dbh = ibase_connect ( $dsn, $username, $password ) or die ("error in db connect");
$stmt="Select * from SHOW_LANGS('SRep',4,'Italy')";
$query = ibase_prepare($stmt);
$rs=ibase_execute($query);
$row = ibase_fetch_row($rs);
echo $row[0];
// free result
ibase_free_query($query);
//ibase_free_result($rs);
// close db
ibase_close($dbh);
*/
?>