2

I would like to acccess a mdb file in a windows machine (windows server 2003) from a linux machine (centos 6.10)

Im using mdbtools and unixodbc

so far what i did

odbc.ini
[mydatabase]
Driver = MDBTools
Description = Microsoft Access Try DB
Servername = localhost
Database =/mnt/example.mdb
UserName =Admin
Password =
port = 5432

odbcinst.ini
[MDBTools]
Description = MDBTools Driver
Driver64 = /usr/lib64/libmdbodbc.so.0
Setup64  = /usr/lib64/libmdbodbc.so.0
FileUsage   = 1
UsageCount  = 1

i check the connection using isql in terminal

isql -v mydatabase

and it returns connected i can query the database successfully by using query like this

select * from units

right now i want to connect the access database using php

test4.php
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);

$myDB = odbc_connect("mydatabase","Admin","");

$query = "select * from units";
$result = odbc_exec($myDB, $query);
$report = odbc_fetch_row($result);
echo odbc_result($result, 1);

odbc_close($myDB);

?>

i received this error

Warning: odbc_connect(): SQL error: Failed to fetch error message, SQL state HY000 in SQLConnect in /var/www/test/test4.php on line 6

Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /var/www/test/test4.php on line 11

Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in /var/www/test/test4.php on line 12

Warning: odbc_result() expects parameter 1 to be resource, null given in /var/www/test/test4.php on line 13

Warning: odbc_close() expects parameter 1 to be resource, boolean given in /var/www/test/test4.php on line 15

im currently using

PHP Version 7.2.28
mySQL Version   5.7.29
darrenx
  • 33
  • 5

0 Answers0