More on using FreeTDS on a server (was Re: [freetds] Server dumpscore...)

Frediano Ziglio freddyz77 at tin.it
Thu Apr 22 16:32:08 EDT 2004


Il mar, 2004-04-20 alle 20:22, Steve Kirkendall ha scritto:
> "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio at vodafone.com> wrote on Monday, Apr 19, 2004:
> > > * Can anybody recommend an alternative ODBC/TDS driver for Windows?
> > >   One that, maybe, would give better error messages?  Or it would also
> > >   be okay if it simply worked, I suppose.
> > 
> > As James said ODBC compile under windows. Also you can enable logging.
> 
> Okay, Windows isn't my native environment so please be patient with me...
> 
> I started VC++ 6.0, loaded the win32\msvc6\FreeTDS.dsw workspace, and
> ran the "Build->Build FreeTDS.dll" menu item.  This resulted in a
> file named win32\msvc6\Debug\FreeTDS.dll.  Is that the ODBC driver?
> 
> If so, how do I install it?  I tried copying it to the %windir%\SYSTEM
> directory (in Windows98), and running a series of ODBCCONF commands
> similar to what MyODBC (part of MySQL) uses.  This resulted in FreeTDS
> appearing in the list of ODBC drivers, but any attempt to use it results
> in error 1157, whatever that means.
> 

See http://lists.ibiblio.org/pipermail/freetds/2003q2/011312.html for
manual configuration. I'm sorry but there is no wizard for FreeTDS (you
have to setup a DSN entry using registry...). freetds.conf must reside
in c:\

> > > * I have a log, produced by FreeTDS, of the network traffic 
> > > in my failed
> > >   attempts to access my little SQL server via Microsoft's ODBC driver.
> > >   Does anybody out there have a similar dump of a *successful* login?
> > >   Nothing fancy, just a TDS4.2 login such as the "test connection"
> > >   button in the ODBC Microsoft SQL Server Setup dialog.
> > 
> > It would be useful if you zip&mail the log..
> 
> I doubt it.  The log file is very tiny, and ends abruptly after the server
> sends its login response.  But I'll attach it anyway -- maybe you can see
> something that I can't.

Mmmm.. I think mssql wants a mssql, so server name should be "Microsoft
SQL Server" and version should be 6.5 (or ms odbc will try to reconnect
with another version).

...

> > Why don't you join to FreeTDS group to improve our (rudimental and not
> > working) server ??
> 
> I'm interested, but a bit hesitant just because my time is limited.
> At work, I'm about to start a huge project that must be done in 3 months
> for a trade show.  What little free time I have will probably be spent
> working on Elvis, my open-source vi clone.
> 

Don't mind, code and if you can send your small server. We'll try to
integrate it for you.

> I will share whatever I get working though.  The big issues I've
> encountered so far are:
> 
> * The unittest.c program uses an initialized TDSLOGIN structure; it should
>   use a pointer to a TDSLOGIN, and call tds_alloc_login() to allocate an
>   initialized structure.
> 

Fixed in CVS.

> * There's no way for high-level functions to know what type of packet is
>   received, because the tds_read_packet() function discards that byte.
>   I added an in_flag field to the TDSSOCKET structure, and modified
>   tds_read_packet() to store the packet type there.  (Clients don't care
>   because the server always sends 0x04 packets after login.  But servers
>   need to know the packet type because that's the only way it can tell
>   the difference between a query and an RPC call.  Also, it should allow
>   your server to handle TDS4.2 or TDS7 login packets equally well.)
> 

Sounds ok.

> * The tds_get_query() function seems to expect a 6-byte header at the
>   start of each query, but queries (at least the ones from tsql) have
>   no header.  To find the query's length, check the packet length.

Not that easy for server but very nice for client :)
Yes, you haven't query length, simply there is a flag in header that
tell you that this is the last packet.

freddy77





More information about the FreeTDS mailing list