You connect with the odbcConnect
function in the [haskelldb-hdbc-opbc][1]
package.
Here is at its source:
odbcConnect :: MonadIO m => SqlGenerator -> [(String,String)] -> (Database -> m a) -> m a
odbcConnect gen opts = hdbcConnect gen (connectODBC conninfo)
-- strangely enough, mysql+unixodbc want a semicolon terminating connstring
where conninfo = foldr (\(k,v) z -> k ++ "=" ++ v ++ ";" ++ z) [] opts
There we can see that it calls out to connectODBC
which you know how to use already. The difference is that here we take a list of pairs of (OptionName,OptionValue)
rather than a simple string, and those options get rendered as key=value;
pairs in the connection string passed to connectODBC
.