Hi Björn,
thanks for your hint, I finally made HDBC-odbc and even hsql-mysql run.
Below is a step-by-step manual how to install both packages on windows
for people having the same troubles I had. I used GHC 6.8.3.
MySQL from HDBC-odbc
********************
1.) Install package time-1.1.2.4.
2.) Download package convertible-1.0.5. In convertible.cabal find the line
Build-Depends: ..., time>=1.1.2.4, ...
and replace it by
Build-Depends: ..., time>=1.1.2.4 && <1.1.3, ...
Now the installation shouldn't fail with a compilation error.
3.) Download package HDBC-2.1.1, modfiy HDBC.cabal in the same way as in
2.) and install the package.
4.) Install package HDBC-odbc-2.1.0.0.
5.) There still was one thing I didn't know that made my example fail
with an exception. You need to install a MySQL ODBC connector for
Windows (available from dev.mysql.com).
6) Now the following example should return a list of all table names in
the database:
import Database.HDBC
import Database.HDBC.ODBC
main :: IO ()
main = do
conn <- connectODBC "DRIVER={MySQL ODBC 5.1 Driver};
SERVER=my_server; DATABASE=my_database; UID=my_username;
PASSWORD=my_password"
qs <- quickQuery' conn "show tables" []
mapM_ (\[SqlByteString table] -> print table) qs
disconnect conn
(There's also a getTables function but it always returns an empty list
on my system, I don't know why).
MySQL from hsql-mysql
*********************
1.) Install package hsql-1.7.1.
2.) Download package hsql-mysql-1.7.1. In hsql-mysql.cabal find the line
include-dirs: Database/HSQL, /usr/include/mysql
and replace it by
include-dirs: Database/HSQL
Also find the line
extra-lib-dirs: /usr/lib/mysql
and remove it.
3.) Do a
runghc Setup configure --extra-include-dirs=
Maciej Podgurski schrieb:
So I switched to HDBC-2.1.1 and got the next compile error:
Building convertible-1.0.5...
Data/Convertible/Instances/Num.hs:671:0: warning: no newline at end of file [...] [5 of 8] Compiling Data.Convertible.Instances.C ( Data/Convertible/Instances/C.hs, dist\build/Data/C onvertible/Instances/C.o ) [6 of 8] Compiling Data.Convertible.Instances.Time ( Data/Convertible/Instances/Time.hs, dist\build/ Data/Convertible/Instances/Time.o )
Data/Convertible/Instances/Time.hs:64:0: Duplicate instance declarations: instance Typeable NominalDiffTime -- Defined at Data/Convertible/Instances/Time.hs:(64,0)-(65,42) instance Typeable NominalDiffTime -- Defined in time-1.1.3:Data.Time.Clock.UTC
Data/Convertible/Instances/Time.hs:67:0: Duplicate instance declarations: instance Typeable UTCTime -- Defined at Data/Convertible/Instances/Time.hs:(67,0)-(68,34) instance Typeable UTCTime -- Defined in time-1.1.3:Data.Time.Clock.UTC
Hi Maciej,
this is quite easy to fix (although a little bit dirty). The problem is that time-1.1.3 now defines some Typeable instances which time-1.1.2.4 did not and which are therefore defined in convertible, too. I don't know a general fix to the problem, but you can either
- download the convertible package and comment out the two instance declarations as shown in the error message and then cabal install it - install from Hackage with additional constraint: cabal install convertible --constraint=time<1.1.3
I hope this will help you get HDBC running.
Cheers, Björn
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe