[Haskell-cafe] Access to Oracle database from Haskell

Alistair Bayley alistair at abayley.org
Fri Jun 20 05:51:01 EDT 2008


2008/6/20 Alistair Bayley <alistair at abayley.org>:
>> Is there a way of accessing a remote Oracle database by one of the common
>> Haskell database interfaces (HaskellDB, Takusen, etc.) ? I tried to get
>> unixODBC and Oracle's Instant Client running on a Linux machine, but I'm
>> trapped in the notorious error:
>
> Takusen's Oracle backend uses the Oracle Call Interface (OCI) library
> directly. I think most Oracle client drivers (ODBC, ADO.Net, etc) use
> the OCI. I don't know what the Oracle Instant Client is; I'll assume
> that it includes an oci.so or liboci.so. On Windows, with which I am
> most familiar, the Oracle client software is all installed in
> $ORACLE_HOME, and the OCI library is $ORACLE_HOME/bin/oci.dll. If you
> can locate that, then you ought to be able to use Takusen with it.

Having just taken a closer took at what Oracle Instant Client is, I
suspect that you might have some trouble getting Takusen to compile
against it. The Instant Client lacks header files, while Takusen's FFI
imports specify oci.h. I don't know what happens if ghc can't find the
header files. Oracle do state that the Instant Client is for
deployment only; developers (that means you) will need the full client
installation.

Another problem is that the Oracle installation process assumes that,
for all platforms, the library is called oci i.e. the linker option
-loci is used. For Unix clients, the OCI library seems to be
libclnstsh.so, so I guess it should pass -lclnstsh. This highlights
the lack of testing on non-Windows platforms. If you'd like to help
get this working better, perhaps we can discuss off-list.

Alistair


More information about the Haskell-Cafe mailing list