[Haskell-cafe] Access to Oracle database from Haskell

Henning Thielemann lemming at henning-thielemann.de
Thu Jun 26 09:59:23 EDT 2008


On Thu, 26 Jun 2008, Alistair Bayley wrote:

> Yes, puzzling. I don't know why you need to say -lclntsh, because
> that's the point of all of this Setup shenanigans: to get things set
> up so that ghci works nicely.
>
> That's why we have flags that expose/hide modules in the API: ghci has
> a custom linker, and this tries to link everything in the library, and
> of course this fails if you don't have the .ddl/.so installed for a
> particular backend. ghc uses gnu ld to link, and this does not try to
> link unused modules, so this works fine with the entire library API
> compiled.
>
> Do you need to say -lclntsh when you use ghc to compile?

Ah, I see, I must run both GHCi and GHC with -package Takusen and 
everything is fine.

>> Next step is to fetch real data from the database. But now I encounter new
>> problems. If I write a real 'select' statement I get at best:
>>
>> Unexpected null in row 1, column 1.
>> *** Exception: (unknown)
>
> This looks like you are fetching a null value back with an iteratee
> that does not expect nulls. We use Maybe to specify that a column in
> the result-set can be null e.g.
>
>  iter :: Int -> Maybe Int -> Maybe String -> IterAct [(Int, Maybe Int, Maybe String)]

Indeed, using Maybe as type solves that problem.

>> and at worst:
>>
>> 50001752
>> *** glibc detected *** /usr/lib/ghc-6.8.2/ghc-6.8.2: free(): invalid
>> pointer: 0x08d10065 ***
>> ======= Backtrace: =========
>
> If this continues, can you provide a test case for me?

I cannot reliably reproduce this. Sometimes it seems that the first run of 
'main' succeeds, and the second one crashes in GHCi.


So, many thanks for the help!


More information about the Haskell-Cafe mailing list