I'm trying to work with ODBC on a Mac OS X 10.14 comp.
My devel env have a nginx webserver and php 7.3.10.
After following some guides, I've installed mdbtools
with odbc support.
I can read my access database with isql
, via odbc name or DSN.
Command: isql -v -k "Driver=MDBTools;DBQ=/database.accdb;"
Command: isql -v MyODBOrigin
Using both connection commands, isql
connects OK, and I can use a SELECT * FROM MyTable
to see data.
Now, the problems:
Using PHP odbc_connect
:
$connection = odbc_connect('MyODBCOrigin', '', '');
$res = odbc_exec($connection, 'SELECT * FROM MyTable');
while(odbc_fetch_row($res)){
for($i=1;$i<=odbc_num_fields($res);$i++){
echo "Result is ".odbc_result($res,$i);
}
}
PHP Error:
( ! ) Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 21474836512 bytes) in /web/odbc.php on line 34
Call Stack
# Time Memory Function Location
1 0.0003 410408 {main}( ) .../odbc.php:0
2 0.5053 434576 odbc_result ( ) .../odbc.php:34
Using PDO:
$connection = new \PDO('odbc:MyODBCOrigin');
$connection = new \PDO('Driver=MDBTools;DBQ=/database.accdb;');
Using both connection methods causes odbc to die (nginx returns a 404 error).
ODBC Trace:[ODBC][31713][1570202266.779582][__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x7f8844001200 [ODBC][31713][1570202266.779895][SQLSetEnvAttr.c][189]
Entry:
Environment = 0x7f8844001200
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0 [ODBC][31713][1570202266.779998][SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS] [ODBC][31713][1570202266.780138][SQLSetEnvAttr.c][189]
Entry:
Environment = 0x7f8844001200
Attribute = SQL_ATTR_CP_MATCH
Value = 0x0
StrLen = 0 [ODBC][31713][1570202266.780217][SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS] [ODBC][31713][1570202266.780316][SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x7f8844001200 [ODBC][31713][1570202266.780419][SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x7f8844008a00 [ODBC][31713][1570202266.780493][SQLSetConnectAttr.c][399]
Entry:
Connection = 0x7f8844008a00
Attribute = SQL_ATTR_AUTOCOMMIT
Value = 0x1
StrLen = -6 [ODBC][31713][1570202266.780562][SQLSetConnectAttr.c][691]
Exit:[SQL_SUCCESS] [ODBC][31713][1570202266.780625][SQLSetConnectAttr.c][399]
Entry:
Connection = 0x7f8844008a00
Attribute = SQL_ATTR_ODBC_CURSORS
Value = 0x0
StrLen = -6 [ODBC][31713][1570202266.780684][SQLSetConnectAttr.c][691]
Exit:[SQL_SUCCESS] [ODBC][31713][1570202266.780752][SQLConnect.c][3721]
Entry:
Connection = 0x7f8844008a00
Server Name = [MyODBCOrigin][length = 7 (SQL_NTS)]
User Name = [NULL]
Authentication = [NULL]
UNICODE Using encoding ASCII 'US-ASCII' and UNICODE 'UCS-2-INTERNAL'
Configuration used for tests:
Myodbc.ini
:
[MyODBCOrigin]
Description = Example
Driver = MDBTools
Servername = localhost
Database = /database.accdb
UserName =
Password =
port = 5432
My odbcinst.ini
:
[ODBC]
Trace = 1
TraceFile = /tmp/odbctrace.log
[MDBTools]
Driver = /usr/local/lib/libmdbodbc.dylib
Setup =
Anyone can help me with this problem?
EDIT
I've found this "bug report" on mdbtools repository. That seems to be the same problem. I've tried the solution suggested on last comment but it's not working.
EDIT2
Using SQL_CUR_USE_ODBC
as parameter for odbc_connect()
return a 404
nginx error (odbc process die, same error as with pdo). Using SQL_CUR_USE_DRIVER
, returns the specified error (fatal error detail on this post).