[freetds] ODBC configuration dialog on Windows

Steve Kirkendall skirkendall at dsl-only.net
Sun May 2 14:09:05 EDT 2004

Before I begin my reply, here's some good news:  I have successfully used
Crystal Reports to pull data from my Linux box!  I read my first table
Saturday morning.  There's still a lot of work to do (for example, I can't
send error messages back yet) but this is a HUGE milestone!

Frediano Ziglio <freddyz77 at tin.it> wrote on Sunday, May 02, 2004:
> Il sab, 2004-05-01 alle 02:06, Steve Kirkendall ha scritto:
> > Quick recap: I'm writing a tiny SQL server to allow Windows workstations
> > to access data on a Linux box, so they can run Crystal Reports.  I was
> > trying to use the MS SQL Server ODBC driver because it is usually already
> > installed on Windows workstations, and because it is pretty easy to
> > configure.  The FreeTDS ODBC driver can be compiled for Windows, but is
> > very hard to install and configure.
> > 
> I don't think it's so easy to write an installer program or enable
> registration of freetds.dll with regsrv32 (although this should register
> only COM classes :) )

I looked into that.  Null Soft, the company that wrote WinAmp, has created
a free installer-creator program named "NSIS".  I haven't had a chance to
try it out yet, but it's reassuring to know there are free alternatives to

For now, I'm just using a *.bat file which copies freetds.dll into the
appropriate directory and then runs ODBCINST to alert ODBC to the presence
of the new driver.  It's clunky and doesn't support automatic removal, but
it has met my needs so far.

> > 3) In the ODBC.INI information, what is the relationship between
> >    "Servername", "Server", and "Address"?  It looks like "Servername"
> >    is obsolete, "Server" identifies the host that ODBC should connect to
> >    (either as a domain name or a "numbers and dots" IP address), and
> >    "Address" is always the IP address in "numbers and dots" format.
> >    Is that right?  Why is "Address" stored in ODBC.INI?
> > 
> My suggestion is "forget servername" all users want real server name so
> use server. Is useful only if you use other libraries (ctlib/dblib).
> Also under windows freetds.conf is in c:\ ... not that fine.. "Address"
> was added for compatibility with MS ODBC and to solve DNS resolve
> problems (/etc/hosts is not editable to everyone...). I think there
> should be an "Advanced" button for "Address" and (if you require it)
> "Servername".

I use a TDSCONNECTINFO structure as the edit buffer.  It has no field
for storing "ServerName" so I ignore it.  In fact, I don't even have a
C:\FreeTDS.conf file.

Currently I prompt for "Server", and derive "Address" from that as part
of the validation testing.  It seems to work.  And you are allowed to
put a "numbers and dots" address in the "Server" field too, so you really
aren't losing any flexibility that way.

I was just uncertain about the fields' meanings because "Server" is
stored into the TDSCONNECTINFO.server_name field, and tds_alloc_connect()
gives that field the default value "SYBASE", which looks more like a
data source name than a DNS name.  That's important, because the values
of the TDSCONNECTINFO fields are used to populate the dialog's input
fields -- the user sees "SYBASE" as the default server name.  You might
consider changing the default to "localhost".

I don't want to add an [Advanced] button -- not yet, anyway.  Once other
people have a chance to see it and use it, we can easily go back and
modify it if necessary.

Oh, one other thing: I also added a login dialog.  In addition to the
prompts for user name and password, it also has a checkbox to enable
logging.  The log file is always "FreeTDS.log" on the desktop.  I added
this to the login dialog, instead of the configuration dialog, because
odbc_get_dsn_info() doesn't load the TDSCONNECTINFO.dump_file field.

odbc_get_dsn_info() DOES load "Language", "Domain", "TextSize", and
"PacketSize", none of which appear on my configuration dialog.  They
would be good candidates for an advanced dialog.

> > 4) The Windows resource file also stores a version number.  It's nice to
> >    see a version number in the ODBC drivers list, but I'm worried about
> >    maintenance.  Somebody would have to remember to go in and update the
> >    version number in the resource file whenever FreeTDS' version number
> >    changed.  Unless somebody knows an automated way to do that.  Opinions?
> See James reply.

When compiling with MSVC++, the configure script isn't used.  Is there a
script you use when building source distributions?  You could but the
command there.

Steve Kirkendall    |A:It is confusing, since people don't read that way
kirkenda at cs.pdx.edu |Q:Why is top-posting bad?
                    |A:It is adding comments to the top of a message
                    |Q:What is top-posting?

More information about the FreeTDS mailing list