Broken error reporting with ODBC app, w/ patch
Ken Ellis
kaellis@REDACTED
Mon Jan 31 03:48:04 CET 2011
The ODBC app does not report informative error messages for connection
issues. It always reports "No SQL-driver information available",
which is misleading since something as simple as attempting to connect
to a database that does not exist will return this error. This is due
to a bad handle being passed in db_connect in odbcserver.c --
incorrectly as a statement handle instead of a db connection handle.
See patch below.
With the patch you get:
{error,"[unixODBC]Sending the authentication packet failed;\nCould not
connect to remote server. Connection to database failed."}
or
{error,"[unixODBC][Driver Manager]Data source name not found, and no
default driver specified Connection to database failed."}
In the current version both of the above errors would result in the
same message:
{error,"No SQL-driver information available. Connection to database failed."}
A google search suggests a reasonable amount of time could be saved
for those trying to use this package:
http://www.google.com/search?q=erlang+odbc+%22No+SQL-driver+information+available%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
-Ken
diff otp_src_R14B01/lib/odbc/c_src/odbcserver.c
otp_src_R14B01_working/lib/odbc/c_src/odbcserver.c
475c475
< diagnos = get_diagnos(SQL_HANDLE_STMT, statement_handle(state));
---
> diagnos = get_diagnos(SQL_HANDLE_DBC, connection_handle(state));
More information about the erlang-questions
mailing list