mdbtools / mdbtools

MDB Tools - Read Access databases on *nix
GNU General Public License v2.0
997 stars 208 forks source link

PHP: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) #99

Closed peldax closed 4 years ago

peldax commented 8 years ago

Hi

I installed your driver on our linux server yesterday (compiled from source i downloaded from github). I have to use MSAccess together with MySQL because our client relies on application which use it. MSAccess database file has 60 Mb. We have PHP application with Nette framework and our problem is that odfc_fetch_fetch array throws following error:

Allowed memory size of 1073741824 bytes exhausted (tried to allocate 3730789209 bytes)

This behavior doesn't make any sense, because the database is only 60mb big.

/etc/odbc.ini file:

[Northwind]
Description = MDBTools
Driver = /usr/local/lib/libmdbodbc.so
Database = /srv/www/pohoda.mdb

PHP code that throws error:

$sql = 'SELECT ID, Firma, Jmeno, Utvar, Obec, Ulice, PSC,
                       Firma2, Jmeno2, Utvar2, Obec2, Ulice2, PSC2,
                       ICO, DIC, Tel, Tel2, RefStr
                FROM AD';
$res = odbc_exec($this->getConnection(), $sql);

while ($row = odbc_fetch_array($res)) // error is thrown here
{
    // 
}

PHP odbc connection:

odbc_connect('Driver={libmdbodbc.so};DBQ=' . $dataDir . '/' . $dataFile, '', ''));

Have you encountered similar problem? Do you have an idea how to avoid this problem? Then don't hesitate and reply. :)

smentink commented 7 years ago

I'm having the same issue, is there any way to fix this?

evanmiller commented 4 years ago

Hi, we have many improvements to the ODBC driver in #162. Please try that code and let me know if it fixes your issue.

peldax commented 4 years ago

Hi, I dont use the MSAccess nor the driver anymore.

evanmiller commented 4 years ago

@peldax Thanks for letting me know. I am closing the issue. If anyone experiences the same issue on the latest code, please open a new issue.