Discussion:
[Firebird-odbc-devel] Could not coonect from php via odbc driver
Gerardo López
2011-07-12 18:12:08 UTC
Permalink
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, I try to connect to a firebird 2 database via php - odbc driver,
but i can't.<br>
<br>
My php code&nbsp; is<br>
&lt;?php<br>
$dbh = odbc_connect('bd1','',''); <br>
$res = odbc_exec($dbh, 'select * from personas');<br>
?&gt;<br>
<br>
And when&nbsp; execute&nbsp; results in this error:<br>
<br>
<b>Warning</b>: odbc_exec() [<a
href="http://nicasio/MisPhp/Clipper/prottv/function.odbc-exec">function.odbc-exec</a>]:
SQL error: [unixODBC][ODBC Firebird Driver][Firebird]invalid database
handle (no active connection), SQL state S1000 in SQLExecDirect in <b>/media/windowsd/Informacion/Gerardo/MisPhp/Clipper/prottv/prueba1.php</b>
on line <b>3</b><br>
<br>
Is like, the connection fails isn't it? But when I try to connect from
other sources, like OpenOfficeBase or the utility "DataManager" from
unixodbc i can connect.&nbsp; Even had some problems with the utility&nbsp;
ODBCConfig from unixodbc. When i try use it for create de Dsn drivers,
it show a error message "Could not construct a property list for
(Firebird)" and&nbsp; fires me away. Then I create the content of the
odbcinst.ini&nbsp; odbc.ini with a scite text procesor.<br>
<br>
Well I triying to resolve this five days ago , find documentation, the
web etc. etc. and I can't solve it.<br>
<br>
Could you helpme ? Below (some aditional data about my configuration
files)<br>
Thanks in advance from Uruguay<br>
Gerardo<br>
<br>
I' Using Ubuntu Linux 8.04 LTS<br>
Install unixodbc, and the firebird driver (libOdbcFb.so in
/usr/lib/odbc) and restart the lighty web server.<br>
<br>
<b>My odbcinst.ini file on /etc is</b><br>
<br>
<br>
[ODBC]<br>
FileDSNPath&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = /etc/ODBCDataSources/<br>
<br>
[Firebird]<br>
Description&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = InterBase/Firebird ODBC Driver<br>
Driver&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = /usr/lib/odbc/libOdbcFb.so<br>
Driver64&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = <br>
Setup&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = /usr/lib/odbc/libOdbcFb.so<br>
Setup64&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = <br>
UsageCount&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = <br>
CPTimeout&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = <br>
CPReuse&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; = <b><br>
<br>
My odbc.ini file on /etc is </b><br>
<br>
[BDBam]<br>
Description = Otra base Firebird <br>
Driver = Firebird<br>
Dbname =
localhost:/media/windowsd/Informacion/Gerardo/MisPhp/Clipper/BDBam.fdb<br>
User = sysdba<br>
Password =masterkey<br>
[bd1]<br>
Description = Prototitpo TodoTv. base firebird<br>
Driver = Firebird<br>
Dbname =
nicasio:/media/windowsd/Informacion/Gerardo/MisPhp/Clipper/bdProTTV.fdb<br>
User = sysdba<br>
Password =masterkey<br>
Role =<br>
CharacterSet =<br>
ReadOnly = No<br>
NoWait = No<br>
<br>
<br>
</body>
</html>

Loading...