[freetds] FreeTDS as a data access API from OS X

James K. Lowden jklowden at freetds.org
Sun Aug 23 17:57:28 EDT 2009


Robert Mullen wrote:
> I have looked at the API  
> documentation on FreeTDS.org and have seen the implementation of  
> programs like TSQL but am still having problems with some of the  
> functions. I wonder if maybe I am barking up the wrong tree by trying  
> to code my framework in the same manner as something like TSQL as  
> opposed to using the iODBC interface.  

You can write your framework in terms of any API.  I've written two; one
of them works with either db-lib or ODBC.  I've never been tempted to
bypass the API layer.  

You are perhaps unaware that libtds is simply a collection of functions
used to implement the client APIs.  It's not a "finished" layer; writing
directly to it would only lead to tears and wouldn't be any more
efficient.  You'd just end up implementing your own API layer anyway.  

iODBC is a driver manager.  While it's true that a DM implements some of
the ODBC API, most functions are implemented by the driver.  

My complaint about ODBC -- and the reason I recommend db-lib, all things
equal -- is that ODBC, being a generic database API, tends to produce
generic error messages.  DB-Library on the other hand was written
specifically for SQL Server and has no "driver", and consequently its
messages tend to be clearer.  To see what I mean, compare the messages in
src/odbc/error.c and src/dblib/dblib.c.  

"Invalid cursor state".  I always love that one.  

HTH.  

--jkl


More information about the FreeTDS mailing list