Reputation: 21
I can connect a .eft database file with Firebird driver like this:
$pdo = new PDO("odbc:DRIVER={Firebird/InterBase(r) driver}; dbname=$dbName;", $user, $pass);
When i try do a simple query
$stmt = pdo()->exec("select 1+1 as somma");
the result is that:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: -104 [ODBC Firebird Driver][Firebird]Dynamic SQL Error SQL error code = -104 Unexpected end of command - line 1, column 15 (SQLExecDirect[-104] at ext\pdo_odbc\odbc_driver.c:247)' in D:\PROGRAMMAZIONE\ricoplast\com\db.php:25
Someone can help me?
PS: When I do the same with different ODBC driver :
$pdo = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; ...
the query works.
Upvotes: 2
Views: 958
Reputation: 22749
The problem is that
select 1+1 as somma
is not a valid Firebird query, you need to have a table from where to select. Try
select 1+1 as somma from rdb$database
The rdb$database
table in Firebird is like dual
in Oracle.
Upvotes: 3