|
From: Bill S. <bil...@hi...> - 2009-02-03 12:12:59
|
Hello
I am using a osx server (leopard) with apache and PHP installed.
Now what I want to do is to connect to a 4D-Database through a iODBC DSN
Connection.
I installed a System DSN and tested the connection with iodbctest and it
worket well.
Now when I try to connect from PHP I get the following error:
Warning: odbc_connect() [function.odbc-connect]: SQL error:
[iODBC][Driver Manager]Specified driver could not be loaded, SQL
state IM003 in SQLConnect in /Library/WebServer/Documents/infoDSN.php
on line 46
My PHP code looks as following:
putenv("ODBCINSTINI=/path/to/odbcinst.ini");
putenv("ODBCINI=/path/to/odbc.ini");
$dsn="DSN_NAME";
$user="username";
$password="password";
$sql="SELECT * FROM table";
// directly execute mode
if ($conn_id=odbc_connect("$dsn","","")) {
echo "connected to DSN: $dsn";
if($result=odbc_do($conn_id, $sql)) {
echo "executing '$sql'";
echo "Results: ";
odbc_result_all($result);
echo "freeing result";
odbc_free_result($result);
}else{
echo "can not execute '$sql' ";
}
echo "closing connection $conn_id";
odbc_close($conn_id);
}
else{
echo "can not connect to DSN: $dsn ";
}
of course, the DNS, username and password are just placeholders.
Can somebody help me? I'm really stuck right now....
Thanks
|