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

Steve Kirkendall skirkendall at
Sun Apr 25 18:50:34 EDT 2004

"ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio at> wrote on Friday, Apr 23, 2004:
> I don't understand why you want to use mssql2k syntax... if the reason
> is to use default ms sql odbc drivers (or ADODB or other proprietary
> libraries) I discourage you.

That is indeed the reason.  I don't want to get involved with telling
hundreds of non-technical users how to install another ODBC driver, even
if the installation is easy.  So far I haven't been able to make the
FreeTDS ODBC driver work in Windows at all, despite the help from folks
on this mailing list.  At least with the SQL Server driver I'm making
some progress.

> The reason is that you MUST implement:
> - advanced types (unicode, guid, variant)

I'm only interested in reading the files of my existing application,
and it doesn't use any of those advanced types.

> - system tables (syscomments and others)
> - prepared statement (server side)
> - some internal store procedure (sp_prepare, sp_tables, sp_typeinfo...)

These could be a pain.  That's my biggest worry right now.  My hope is
that, since this is a read-only database, I can ignore most of it.

I'm finally receiving some queries from the Windows SQL Server ODBC
driver, and some of them look rather strange.  My favorite so far is
"select 501,NULL,1 where 'a'='A'".  What's that supposed to do?
I didn't even know you could have a SELECT statement without a FROM
clause.  Should it use an implied table with 0 rows?  1 row?  An
infinite number of rows?  And what should the column names be?

Oh, by the way: To get past the logins, I'm just sending a 253 packet.
I do *not* call tds_send_login_ack(), or any of the environment or
capability stuff.

> Version 4.2 is easier to implement (no prepared, no guid, variant, fewer
> procedure).

In the SQL Server ODBC setup, the first question it asks is how to
log in: Using NT authentication with your network user id and password
(which implies TDS7.0) or with a manually entered ID and password
(which implies TDS4.2).  I chose the latter.

It seems to affect the SQL queries that it uses to obtain server
information too.

> > I thought the entire content of a 0x01 packet was a query because
> > the tsql program seems to send them that way.  The tds_get_query()
> > function expects a 6-byte header at the start of each query, so it
> > doesn't work correctly with tsql.  But it looks like the
> > tds_get_query() function is right, and tsql is wrong.  Maybe.  I'm
> > not 100% confident of that; I'll look into it tomorrow.
> I don't think tsql is wrong... Language query are just the payload
> (without packet header) content, packet type 1.

Yeah, the queries from the SQL Server ODBC driver are coming in with
no headers too.  So I guess tsql is right and tds_get_query() is wrong
after all.

Steve Kirkendall    |A:It is confusing, since people don't read that way
kirkenda at |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