[unixODBC-support] unixODBC+MDBTOOLS+ACCESS : Problem with WHERE conditions

Olivier BONHOMME olivier.bonhomme at b2i-toulouse.com
Fri Jan 21 14:35:50 GMT 2005


Hello everybody,

I have a strange problem using unixODBC+MDBTools in order to use a 
Microsoft Access 2000 database. I use PHP on a FreeBSD 5.3 Box. 
Everything is OK for the connection to the database and I can make 
simple SELECT queries to the database.

The problem is when I try to make queries with WHERE conditions. On this 
way, unixODBC says every time the following message :

*Warning*: odbc_exec(): SQL error: [unixODBC]Couldn't parse SQL , SQL 
state 08001 in SQLExecDirect in 
*/usr/home/ptitoliv/public_html/testodbc.php* on line *8
*
It is not a syntax problem because this query works perfectly in ACCESS. 
I tried to log the connection :

[ODBC][3738][SQLAllocHandle.c][463]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x80ff000
[ODBC][3738][SQLConnect.c][3526]
                Entry:
                        Connection = 0x80ff000
                        Server Name = [qualite][length = 7 (SQL_NTS)]
                        User Name = [][length = 0 (SQL_NTS)]
                        Authentication = [][length = 0 (SQL_NTS)]
                UNICODE Using encoding ASCII 'char' and UNICODE 
'UCS-2-INTERNAL'

[ODBC][3738][SQLConnect.c][4100]
                Exit:[SQL_SUCCESS]
[ODBC][3738][SQLAllocHandle.c][510]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x80ff000
[ODBC][3738][SQLAllocHandle.c][872]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x8102800
[ODBC][3738][SQLGetInfo.c][211]
                Entry:
                        Connection = 0x80ff000
                        Info Type = SQL_FETCH_DIRECTION (8)
                        Info Value = 0xbfbfce8c
                        Buffer Length = 4
                        StrLen = 0x0
[ODBC][3738][SQLGetInfo.c][522]
                Exit:[SQL_SUCCESS]
[ODBC][3738][SQLSetStmtOption.c][174]
                Entry:
                        Statement = 0x8102800
                        Option = SQL_ATTR_CURSOR_TYPE
                        Value = 2
[ODBC][3738][SQLSetStmtOption.c][370]
                Exit:[SQL_SUCCESS]
[ODBC][3738][SQLExecDirect.c][233]
                Entry:
                        Statement = 0x8102800
                        SQL = [SELECT XDATE FROM ListePropositions WHERE 
ListePropositions].REVISION="00"][length = 76 (SQL_NTS)]
[ODBC][3738][SQLExecDirect.c][496]
                Exit:[SQL_ERROR]
                DIAG [08001] Couldn't parse SQL

Here are my configuration files :

/usr/local/etc/odbcinst.ini
[ODBC]
Trace = Yes
TraceFile = /tmp/sql.log


[MDBToolsODBC]
Description     = Driver ODBC pour bases Access
Driver          = /usr/local/lib/libmdbodbc.so.0
Setup           =
FileUsage       = 1
CPTimeout       =
CPReuse         =
UsageCount      = 1
Trace           = Yes
TraceFile       = /tmp/sql.log

/usr/local/etc/odbc.ini

Description = "Base de Donnees ACCES"
Driver = MDBToolsODBC
Database = /home/qualite/bdprojets.mdb
Servername = localhost
Trace: Yes
TraceFile: qualite.log
Username =
Password =
port = 5432

I have no idea about the solution. Does anybody had got this problem ?

Thank you for your answers

Best Regards

OIivier BONHOMME







More information about the unixODBC-support mailing list