I tried to connect to MS Access database using PHP PDO from my ubuntu webserver but couldn't. I got this error:
Connexion Access échouée : SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
My connection class is:
class GesEcoleService{
var $dsn;
var $user;
var $password;
var $dbh;
public function Connect(){
$this->dsn = 'odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=/var/www/rep/bd/GesEcoles.mdb;Uid=';
$this->user = '';
$this->password = '';
try {
$this->dbh = new PDO($this->dsn, $this->user, $this->password);
}
catch (PDOException $e) {
echo 'Connexion Access échouée : ' . $e->getMessage();
}
}
}