Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sudo apt install php7.2-odbc
- ...
- Setting up php7.2-odbc (7.2.10-0ubuntu0.18.04.1) ...
- Creating config file /etc/php/7.2/mods-available/odbc.ini with new version
- Creating config file /etc/php/7.2/mods-available/pdo_odbc.ini with new version
- Processing triggers for libapache2-mod-php7.2 (7.2.10-0ubuntu0.18.04.1)
- php -i | grep PDO
- PDO
- PDO support => enabled
- PDO drivers => mysql, odbc, pgsql, sqlite
- PDO Driver for MySQL => enabled
- PDO_ODBC
- PDO Driver for ODBC (unixODBC) => enabled
- PDO Driver for PostgreSQL => enabled
- PDO Driver for SQLite 3.x => enabled
- $db_username = ''; //username
- $db_password = ''; //password
- // path to database file
- $database_path = "/home/jcobban/FamilyTree/Cobban.mdb";
- // check file exist before we proceed
- if (!file_exists($database_path)) {
- die("Access database file not found !");
- }
- //create a new PDO object
- $database = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=$database_path; Uid=$db_username; Pwd=$db_password;");
- $sql = "SELECT * FROM tableName";
- $result = $database->query($sql);
- while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- print_r($row);
- }
- Fatal error: Uncaught PDOException: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib 'Microsoft Access Driver (*.mdb, *.accdb)' : file not found in /home/jcobban/public_html/testAccess.php:14 Stack trace: #0 /home/jcobban/public_html/testAccess.php(14): PDO->__construct('odbc:DRIVER={Mi...') #1 {main} thrown in /home/jcobban/public_html/testAccess.php on line 14
- sudo apt-get install odbc-mdbtools
- sudo apt-get install unixodbc-dev
Add Comment
Please, Sign In to add comment