I have a database with HyperFileSQL and I want to access this database via php. If I use IODBC to connect with iodbc.ini, it works !!! But when I want to connect from php with odbc it doesn't I have this in return :
SQLSTATE[0] SQLDriverConnect: 0 [unixODBC]I
When I connect to the database from iodbc with this line :
iodbctest DSN=DACHFSQL
It works !
this is the my code :`
try{
$conn = new PDO("odbc:Driver={HFSQL};DSN={DACHFSQL};Server=$db_server_name;Port=$port;Database=$database;",$user,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM contacts";
$res_select = $conn->prepare($sql);
$res_select->execute();
} catch (PDOException $e) {
echo 'Échec lors de la connexion : ' . $e->getMessage();}
I don't know why I can't connect... Pleaze help !
You need to compile php with iodbc support (instead of odbc).