[Haskell-cafe] Trivial database access in Haskell
p.f.moore at gmail.com
Mon Dec 11 17:08:08 EST 2006
I'm an Oracle DBA, and I have been looking at Haskell with interest
for a long while now. But I don't feel particularly that I could use
it in my "day job", mainly because I can't seem to find a nice, simple
way of doing (Oracle) database access in Haskell.
What I'm after is very simple - I want to be able to connect to a
database and issue SQL queries and DML (updates, inserts, etc).
There's nothing particularly "functional" in this - it's more of a
basic building block (like file I/O) as far as I'm concerned, so I'm
happy for database access to sit in the IO monad.
I've looked at the various database access libraries for Haskell, but
they all seem to be missing a couple of key pieces if I want to use
1. Simple documentation of how to install the library (starting from a
vanilla GHC installation on Windows, plus Oracle software, to the
point where I can use the library in my code). All I need is Oracle
access, so other database client libraries can be ignored. I'd rather
not use ODBC, but will if required.
2. Simple examples on how to actually run a query. For example, how do
I code the follwing SQL*Plus code (should be pretty self-explanatory)
connect scott/tiger at mydb
select * from emp;
(Connect to the database "mydb" as user "scott", password "tiger", and
issue the query "select * from emp"). Ideally, I'd like the Haskell
code to not be *too* much more verbose than this (although I can
accept that Haskell, beng a general language, won't be able to be
quite as concise as a special tool can manage).
Without this basis, I don't really have a way to evaluate the various
If anyone can offer any assistance, I'd be very grateful.
More information about the Haskell-Cafe