Skip to Content.
Sympa Menu

freetds - Re: ODBC patch suggestion

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: ODBC patch suggestion
  • Date: Thu, 10 Oct 2002 11:59:09 -0400


Another thing I'd like to put forward. ODBC should be able to operate
sans a freetds.conf file being present. We obviously need the conf file
for dblib and ctlib, but there is no reason that the ODBC driver couldn't
read the odbc.ini for the info and fill in a TDSCONFIG structure itself.
This would make life simpler for ODBC-only users, which we seem to be
gaining over time.

I recommend using 'Servername = foo' to refer to the freetds.conf entry
and 'Hostname = foo' to operate independantly. When I get some time free
time again I'll take a crack at it, unless someone wants to take it on
before then.

Brian

> Frediano,
>
> I think many people have trouble lining up the various ODBC .ini files and
> get confused about the meanings of various fields.
>
> The patch below might help. I haven't tested it because I don't have any
> odbc stuff installed. Please apply it if you like it, and change it as you
> see fit, of course.
>
> The idea is that instead of:
>
> isql -v TESTC sa cinar, i get :
> [unixODBC]tds_connect failed
> [ISQL]ERROR: Could not SQLConnect
>
> Cinar would see:
>
> isql -v TESTC sa cinar
> FreeTDS: odbc.c: do_connect: Line 188:
> Unable to connect to [10.50.104.133:1433] as User 'cinar' with
> password of length 5
> [unixODBC]tds_connect failed
> [ISQL]ERROR: Could not SQLConnect
>
> which would tend to highlight the fact that the Servername in his odbc.ini
> corresponds to a [server] entry in freetds.conf.
>
> I don't know anything about error message handling in ODBC, but it would be
> nice if isql displayed a message similar to what tsql would do:
>
> Msg 10019, Level 9, State 0, Server OpenClient, Line 0
> Server [10.50.104.133:1433] not found!
>
> I think diagnostics like these would make it easier for people to sort
> things out independently.
>
> Best regards,
>
> --jkl
>
> Index: odbc.c
> ===================================================================
> RCS file: /cvsroot/freetds/freetds/src/odbc/odbc.c,v
> retrieving revision 1.63
> diff -u -u -r1.63 odbc.c
> --- odbc.c 9 Oct 2002 10:20:55 -0000 1.63
> +++ odbc.c 10 Oct 2002 14:40:24 -0000
> @@ -188,6 +188,13 @@
> return SQL_ERROR;
> tds_set_parent(dbc->tds_socket, (void *) dbc);
> if (tds_connect(dbc->tds_socket, dbc->tds_login) == TDS_FAIL) {
> + /* ODBC is *so* confusing, and for some reason seems to attact
> + the least experienced users. By issuing this message to
> + stderr, a user can see the failure without examining logs.
> + */
> + fprintf( stderr, " FreeTDS: odbc.c: do_connect: Line %d: \n\t\
> +Unable to connect to [%s] as User '%s' with password of length %d\n",
> + __LINE__, server, user, strlen(passwd) );
> odbc_LogError ("tds_connect failed");
> return SQL_ERROR;
> }
>
>
> The information contained in this transmission may contain privileged and
> confidential information and is intended only for the use of the person(s)
> named above. If you are not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, any
> review, dissemination, distribution or duplication of this communication is
> strictly prohibited. If you are not the intended recipient, please contact
> the sender immediately by reply e-mail and destroy all copies of the
> original message. Please note that for certain accounts we do not accept
> orders and/or instructions by e-mail, and for those accounts we will not be
> responsible for carrying out such orders and/or instructions. Kindly refrain
> from sending orders or instructions by e-mail unless you have confirmed that
> we accept such communications for your account. Please also note that to
> satisfy regulatory requirements we review the outgoing and incoming e-mail
> correspondence of staff members serving certain functions.




Archive powered by MHonArc 2.6.24.

Top of Page