[Haskell-cafe] haskelldb basic documentation needed

Justin Bailey jgbailey at gmail.com
Tue Jan 15 16:44:28 EST 2008


2008/1/15 Immanuel Normann <immanuel.normann at googlemail.com>:

> I don't know what pairs of strings this function needs. The API
> description is to unspecific:
>
> The connect function takes some driver specific name, value pairs use to
> > setup the database connection, and a database action to run.
>
>
> What are the specific name value pairs needed (for a connection to a mysql
> db )?
> Immanuel


Your best bet is to download the appropriate drivers - either
haskelld-hdbc-mysql or haskelldb-hsql-mysql. If you get the haskelldb
sources via darcs, you can also look in the test directory to see how the
connections are established.

In my specific case, I am using PostgreSQL and by login  function looks like
this:

-- ^ Returns a function which can log into the database and perform
operations.
login :: MonadIO m => String -> Int -> String -> String -> String ->
(Database -> m a) -> m a
login server port user password dbname = postgresqlConnect [("host",
server),
  ("port", show port),
  ("user", user),
  ("password", password),
  ("dbname", dbname)]


> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080115/2363a53a/attachment.htm


More information about the Haskell-Cafe mailing list