[Haskell-cafe] HDBC or HSQL

jeff p mutjida at gmail.com
Wed Jul 25 23:06:57 EDT 2007


Hello,

> Would you go as far to say that when new programmers ask which database
> binding to use, we should _recommend_ HDBC then?  (As we do gtk2hs, for
> the gui libraries).
>
I'm not sure about this. Although I didn't extensively compare HSQL
and HDBC, I got the impression that they offered roughly the same core
functionality-- though HDBC seemed to have a few more bells and
whistles, and seems to be better maintained. One thing about HDBC is
that it provides, and to a certain extent encourages using, a function
to lazily retrieve query results. While this can be very convenient,
it can also easily lead to very frustrating errors and/or resource
leaks (just like any lazy IO operation); I eventually had to remove
all trace of this function from my code base.

Ideally something like HaskellDB (i.e. a DSL on top of HDBC or HSQL)
would be the right thing for new Haskell programmers; however
HaskellDB's current documentation really needs to be improved (i.e.
easier to find, more comprehensive, full examples... ) before it makes
sense to recommend it.

Takusen also seems like a good candidate for recommending to new
Haskell programmers; the only reason I haven't seriously considered
switching to Takusen is the lack of ODBC bindings. I think Takusen's
basic design, besides being safe, is quite in line with Haskell and
functional programming; Takusen is also actively maintained. On the
other hand, Takusen probably has a steeper learning curve than HDBC
for a new functional programmer.

At this point in time, my advice to new Haskell programmers would be:
first try Takusen, as long as it can connect to the server you're
using (and don't hesitate to ask the maintainers and/or haskell-cafe
questions); then try HDBC, perhaps avoiding the lazy retrieval
function.

-Jeff


More information about the Haskell-Cafe mailing list