Skip to Content.
Sympa Menu

freetds - [freetds] tds_connect does too much

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: TDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] tds_connect does too much
  • Date: Wed, 9 Jul 2008 07:17:54 -0400

tds_connect() connects to the server and logs in. I plan to change it to
only connect. tds_connect() will return immediately from
tds_open_socket().

The rest of the logic, the part that sends the login packet, will be moved
to a new function. But what to call it? Our namespace is so crowded!
Ideally, it would be called tds_login(), but tds_login is a data
structure. Next best is tds_send_login(), but that's already taken for
sending 4.2/5.0 login packets.

Best is to rename tds_send_login() to tds5_send_login(), and call the new
function tds_send_login().

This will make it easier to distinguish between network-level errors --
DNS lookup errors, server not listening -- from login failures.

It will also make it possible to change tsql to make -U and -P optional,
so the user could be prompted for a username after the connection was
made. You'll be able to see the difference between network and
authentication failures:

$ tsql -S servername
locale is "C"
locale charset is "646"
connected, please log in
username: superman
password: ********
1>

or

$ tsql -S servername
locale is "C"
locale charset is "646"
Msg 20008, Level 9, State -1, Server OpenClient, Line -1
Unable to open socket
There was a problem connecting to the server

Eventually I'd like to see functionality like this:

$ tsql
locale is "C"
locale charset is "646"
servername: elixer
elixer not found in /home/username/.freetds.conf
elixer not found in /etc/freetds.conf
/etc/interfaces not found
elixer.example.com has address 10.1.1.14
connecting to port 4000 with TDS version 5.0
Msg 20008, Level 9, State -1, Server OpenClient, Line -1
Unable to open socket
There was a problem connecting to the server

But that requires rewriting the configuration file parser....

Comments welcome.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page