I'm trying to read formatted MS Access databases after uploading them on server to store the data in it into MySQL server. The database contains memo data type which by using unixODBC with MDBTools and PDO was not readable.
I have PHP 7.2.17-1 running on ubuntu18.04.1 server with unixODBC installed and PDO library up and running, due to it's inability to read the memo data types, I took a suggestion from here and Instead of using the PDO Class in manipulating the access db, I used ODBC Functions to do the job. It worked to an extent of showing the trimmed values, but is not showing the proper text, also it has converted numbers to float values.
Example:
Previously my code looked like this with using PDO Class that did not fetch memo data types.
$query = 'SELECT * FROM Product';
$mdb_file = '/var/www/html/azam/Product.mdb';
$driver = 'MDBTools';
$dataSourceName = "odbc:Driver=$driver;DBQ=$mdb_file;";
$connection = new PDO($dataSourceName);
$result = $connection->query($query)->fetchAll(\PDO::FETCH_ASSOC);
print '<pre>';
print_r($result);
print '</pre>'
I'm using ODBC Functions Now which retrieves trimmed values of memo data types and has converted numbers to float, appending multiple zeros before the decimal value.
$query = 'SELECT * FROM Product';
$mdb_file = '/var/www/html/azam/Product.mdb';
$connection = odbc_connect("Product.mdb","","");
$result = odbc_exec($connection,$query);
while($row = odbc_fetch_array($result))
{ echo "<pre>";
print_r($row);
echo "</pre>";
}
PS : I have configured odbc.ini as suggested and tried casting the query column to varchar(200) which generates error on making the connection, which probably is not supported in this scenario.
I'm expecting ODBC functions to return full length string of memo data type, but it shows trimmed values, also the number data type to be returned as numbers not as float values.