[freetds] FreeTDS driver for Apache/APR
niq at apache.org
Tue May 8 19:58:53 EDT 2007
I have a Client who wants to access an MSSQL database from
an application running in Apache. He pointed me at FreeTDS
as an opensource client library to access it, and I'm looking
at writing a FreeTDS driver under apr_dbd (where it will join
existing drivers for PostgreSQL, MySQL, SQLite and Oracle).
The driver will be released as open source.
I'm not familiar with FreeTDS, nor with MSSQL or SyBase,
so my startingpoint is to look to match the Apache DBD
architecture. Much of the basics are in the header files
and examples provided (assuming the latter are up-to-date),
but that begs the first question: In the light of what I
want to do (see below), what API do I need, from the choice
of db-lib, ct-lib or odbc?
The driver will support basic SQL statements, prepared
statements, transactions, and operations on result sets.
It will support both synchronous and asynchronous operation
(if the backend does - that's FreeTDS in this instance).
It will work in the context of a dynamic connection pool,
where connections are held open. The architecture dictates
that a connection won't switch between threads while there's
a transaction or cursor open, but it will be used sequentially
by different threads. Any hints, tips, gotchas, or examples
working with this kind of model will be welcome. Does the
choice of db-lib/ct-lib/odbc have a bearing on whether I'll
be vulnerable to threading issues or memory leaks?
If prepared statements can be global (shared across FreeTDS
connections rather than tied to a particular connection),
they should be prepared at server startup. Otherwise they
will be prepared per-connection when a new connection is opened.
Is it possible to prepare statements in a global context
to share across all connections?
Application Development with Apache - the Apache Modules Book
More information about the FreeTDS