0

I want to connect to my MS Access Database via PHP (7.2.10), SLE 12.3. For this I'm using the libmdbodbc.so.1 driver which comes with package libmdbodbc1 0.7-3.1 (Source: mdbtools-0.7-3.1). Setup is done in unixODBC config: /etc/unixODBC/odbcinst.ini.

[MdbToolsOdbc]
Description = MDBTools ODBC Driver
Driver = libmdbodbc.so.1
Setup = libmdbodbc.so.1

The connection to the database and getting data via commandline (isql) is possible and does not return error.

But when I'm trying to execute a SQL query via PHP (connection done via: odbc_connect(Driver=MdbToolsOdbc;DBQ=%s, null, null);)

odbc_exec($connection, "SELECT id FROM table");

I got an error "Allowed memory size of 2097152 bytes exhausted (tried to allocate 140 Tbytes)".

The issue is still mentioned here:

https://github.com/brianb/mdbtools/issues/99

https://bugs.php.net/bug.php?id=75013&thanks=3

Does anybody know a solution or workaround for the issue?

Would be nice to get some response!

Thank you and best!

user2625247
  • 361
  • 1
  • 4
  • 15
  • You can check it here https://stackoverflow.com/questions/42132558/odbc-prepare-gives-fatal-error-allowed-memory-size-exhausted – Ankur Tiwari Nov 27 '18 at 11:33
  • Thank you for the fast reply! I installed now ibm-iaccess-1.1.0.10-1.0.x86_64.rpm. I want connect to a .mdb/.accdb MS Access-File. How could I set this? Still tried "Driver={IBM i Access ODBC Driver 64-bit};Data Source=%s;System=localhost" (%s is replaced by path to .mdb/.accdb-File) and other parameters, but always got an error and cannot establish connection to database. – user2625247 Nov 27 '18 at 13:41

1 Answers1

0

Use PDO instead: https://www.php.net/manual/en/ref.pdo-odbc.php

This works for me using a connection to a Filemaker database.