Quantcast

Broken error reporting with ODBC app, w/ patch

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Broken error reporting with ODBC app, w/ patch

Ken Ellis
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:[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Broken error reporting with ODBC app, w/ patch

Alain O'Dea
On 2011-01-30, at 23:18, Ken Ellis <[hidden email]> 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:[hidden email]
>

Better error messages for the win :)

Thank you for posting this Ken!

You should send your patch on to [hidden email] for integration into OTP.  For more information on contributing to OTP see:
https://github.com/erlang/otp/wiki/submitting-patches

Thanks again,
Alain
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Broken error reporting with ODBC app, w/ patch

Ingela Andin
Hi Ken!

Yes please follow the patch instruction:
https://github.com/erlang/otp/wiki/submitting-patches
we will be happy to accept this patch, good catch  :)

Regards Ingela Erlang/OTP team  - Ericsson AB

2011/1/31 Alain O'Dea <[hidden email]>:

> On 2011-01-30, at 23:18, Ken Ellis <[hidden email]> 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:[hidden email]
>>
>
> Better error messages for the win :)
>
> Thank you for posting this Ken!
>
> You should send your patch on to [hidden email] for integration into OTP.  For more information on contributing to OTP see:
> https://github.com/erlang/otp/wiki/submitting-patches
>
> Thanks again,
> Alain
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:[hidden email]
>
>

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:[hidden email]

Loading...