HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

HDBC-ODBC under Windows

Categories: Libraries | How to

A brief description of how to get HDBC-ODBC working under windows, for connecting to things like MS SQL server.

1 Install

          ghc --make -o setup Setup.hs
          setup configure
          setup build
          setup install


You may need other ODBC drivers, but often they will be installed already on a development box that has the database server installed.

2 Test

You can test it from a ghci prompt (obviously you'll need to change the connection string and query):

Prelude> :m Database.HDBC
Prelude Database.HDBC> :m + Database.HDBC.ODBC
Prelude Database.HDBC Database.HDBC.ODBC> let connectionString =  "Driver={SQL Server};Server=myserver;Database=mydatabase;Trusted_Connection=yes;"
Prelude Database.HDBC Database.HDBC.ODBC> let ioconn = connectODBC connectionString
Prelude Database.HDBC Database.HDBC.ODBC> do { conn <- ioconn; vals <- quickQuery conn "SELECT TOP 10 * FROM mytable;" []; print vals }
[[SqlString "1",SqlString "Copy",...

Retrieved from "http://www.haskell.org/haskellwiki/HDBC-ODBC_under_Windows"

This page has been accessed 1,638 times. This page was last modified 21:15, 23 June 2007. Recent content is available under a simple permissive license.