i have site hosted on bluehost.com (Linux Server), i have use case that i have to Export some Specific Data Export to MS Access File,
I have following code to Connect with MS Access File:
$dbh = null;
try{
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$file_path", $user_name, $password, $db_info);
}catch(PDOException $e){
echo $e->getMessage();
}
return $dbh;
But when i run the above code on Hosting server than i got error
SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Later after some searching i changed the code of DB connection to
try{
$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$file_path", ACCESS_DB_USERNAME, ACCESS_DB_PASSWORD);
}catch(Exception $ex){
echo $ex->getMessage();
}
in above code i did not get any exception but $conn is NULL, both code snippet working fine on my local Windows machine,
Can you people help me in fixing issue?? i want to make connection and want to run INSERT INTO statement on MS Access DB.