I'll try to explain it as simply as possible.
macOS 10.12.6, unixODBC library, FileMaker Server 16 and 17
The goal is to make an application connect via ODBC to FileMaker Server, I'm conducting preliminary tests. After configuring the parameters.
the odbc.ini file is as follows, it's replicated in /Library/ODBC and /usr/local/etc (see later):
[FMSA-Dev] Driver = /Library/ODBC/FileMaker ODBC.bundle/Contents/MacOS/fmodbc.so Description = Test connection for development Database = TEST Server = 10.80.22.140 CertificateFailureType = None WideAPI = Yes UnicodeTextTypes = Yes
I can successfully connect with the command, it works fine:
isql FMSA-Dev admin mypassword -v
The trace shows that the old ODBC2 call is used:
[ODBC][1539729055.001373][SQLConnect.c] Entry: Connection = 0x7fcd96016200 Server Name = [FMSA-Dev][length = 8 (SQL_NTS)] User Name = [admin][length = 5 (SQL_NTS)] Authentication = [********][length = 10 (SQL_NTS)] UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL'
I'm using a library that makes use of the newer API for connecting, and it can be also simulated by adding the -k flag. This doesn't work:
isql FMSA-Dev admin mypassword -k -v
It also complains about something impossible, as the data source is the same:
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified [ISQL]ERROR: Could not SQLDriverConnect
The log shows that the new function is called, and it fails:
[ODBC][1539729069.792682][SQLDriverConnectW.c] Entry: Connection = 0x7f802a82d600 Window Hdl = 0x0 Str In = [DSN=Dev;UID=admin;PWD=..removed][length = 33 (SQL_NTS)] Str Out = 0x0 Str Out Max = 0 Str Out Ptr = 0x0 Completion = 0 UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL' [ODBC][1539729069.845738][SQLDriverConnectW.c] Exit:[SQL_ERROR] [ODBC][1539729069.845907][SQLErrorW.c] Entry: Connection = 0x7f802a82d600 SQLState = 0x7ffee9990040 Native = 0x7ffee9990038 Message Text = 0x7ffee9990060 Buffer Length = 500 Text Len Ptr = 0x7ffee999003e [ODBC][1539729069.845967][SQLErrorW.c] Exit:[SQL_SUCCESS] SQLState =  Native = 0x7ffee9990038 -> 1 Message Text = [ [ODBC][1539729069.846056][SQLErrorW.c] Entry: Connection = 0x7f802a82d600 SQLState = 0x7ffee9990040 Native = 0x7ffee9990038 Message Text = 0x7ffee9990060 Buffer Length = 500 Text Len Ptr = 0x7ffee999003e [ODBC][1539729069.846113][SQLErrorW.c] Exit:[SQL_NO_DATA]
One of the problems here is that the FileMaker ODBC library seems to only reference `/Library/ODBC/odbc.ini`, while unixODBC uses `/usr/local/etc/odbc.ini`. If the two files have the same content, they are both used to make the connection with the successful command; the unixODBC config file is used to get the driver path, the other to get the server URL. I believe this is a mistake, the library should not read its file, instead it should take parameters from the caller.
Anyway I need to make it work with the SQLDriverConnect function, instead of the old SQLConnect one. I analysed the source code of unixODBC, the error is generated when calling a function of the FileMaker ODBC library, exactly here I think:
#define CHECK_SQLDRIVERCONNECTW(con) (con->functions.funcW!=NULL) #define SQLDRIVERCONNECTW(con,dbc,wh,ics,sl1,ocs,bl,sl2p,dc)\ (con->functions.funcW)\ (dbc,wh,ics,sl1,ocs,bl,sl2p,dc)
I hope that was clear enough for a developer. I have the situation perfectly reproducible, although I believe it probably won't be fixed anytime soon (never?), still trying is better than nothing.