[erlang-questions] Broken error reporting with ODBC app, w/ patch

Alain O'Dea <>
Mon Jan 31 18:06:54 CET 2011

On 2011-01-30, at 23:18, Ken Ellis <> wrote:

> 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));
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

Better error messages for the win :)

Thank you for posting this Ken!

You should send your patch on to  for integration into OTP.  For more information on contributing to OTP see:

Thanks again,

More information about the erlang-questions mailing list