[Haskell] Haskell DB bindings (was Re: ANN: HDBC (Haskell Database Connectivity)

Keean Schupke k.schupke at imperial.ac.uk
Fri Jan 13 19:47:13 EST 2006

Erm, has nobody replied to this yet? I want a robust interface, that 
uses bracket notation all the way down, so that any error is caught and 
resources are freed appropriately without the use of finalizers (which 
may not get run and lead to resource starvation - they are not reliable 
if dealing with many connections, unless you start forcing garbage 
collections). I want a simple interface (as few functions as possible to 
do the job) and robust exception handling.

I certainly like the idea of using runST to encapsulate the DbHandle... 
and infact the DB code I have does this, but not in a systematic way... 
I guess really all allocated handles that are passed to user defined 
functions need to be protected in this way.

The code I wrote is really to support a relational algebra layer over 
the top...

When I developed this there were no database drivers that worked under 
linux, as HSQL only supported ODBC under windows, so I developed an ODBC 
specific layer myself tested with unixODBC and iODBC.

So IMHO, braket notation, STRef encapsulation, no finalizers, lots of 
exception handling, minimal interface. I would sacrifice some speed for 
simplicity of interface...


Krasimir Angelov wrote:

>There are three active database libraries: HDBC, HSQL and Takusen. It
>is quite disappointing from my point of view. Recently there was the
>same situation with the GUI libraires. The Haskell Community is quite
>small to waste efforts, developing different libraries for the same
>things. When I started with HSQL there were only two database
>libraries: HaSQL for ODBC and libpq for PostgreSQL. They both are
>dead, I think. I decided that it is useful to have one abstract API
>that can cover all database bindings. I imagine something like JDBC,
>ADO or DBI for Haskell. If you guys would like this to happen then
>lets discuss what we want. I would be happy to work on single project
>that can satisfy all needs.
>  Krasimir
>2006/1/10, Tim Docker <timd at macquarie.com.au>:
>>oleg at pobox.com wrote:
>>>Incidentally, the difficulty with finalizers was precisely the
>>>argument for using enumerators rather than cursors in database
>>>APIs. Takusen has implemented that idea; takusen currently supports
>>>Sqlite, PostgreSQL and Oracle, has a test suite. Its performance test
>>>shows that takusen can retrieve 2 million rows from a table without
>>>running out of memory.
>>The differences between HDBC and HSQL have been recently discussed.
>>does Takusen fit into this picture? From the above, it sounds like it
>>quite a different API. Are all 3 of these actively maintained?
>>As someone who may wish to construct a haskell db binding for a new db,
>>not clear to which API it should conform. Sometimes choice is a
>>Haskell mailing list
>>Haskell at haskell.org
>Haskell mailing list
>Haskell at haskell.org

More information about the Haskell mailing list