Hello, I'm trying to use MySQL from Haskell but it seems impossible for me to install one of the MySQL packages on my Windows XP machine. First I tired to install hsql-mysql-1.7.1 on GHC 6.10.3 but installing haskelldb-hsql failed with a hidden package error. So I added the old-time package to the cabal file but there still was a compile error (something due to the change from Exception to Exception e => e). So I switched to GHC 6.8.3 and tried it again. Now it says: Configuring hsql-mysql-1.7.1... Warning: 'extra-lib-dirs: /usr/lib/mysql' directory does not exist. Warning: 'include-dirs: /usr/include/mysql' directory does not exist. Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package process-1.0.0.1 requires filepath-1.1.0.0 package directory-1.0.0.1 requires filepath-1.1.0.0 package Cabal-1.6.0.3 requires filepath-1.1.0.2 Setup: Missing dependency on a foreign library: * Missing C library: mysqlclient This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. There's no Haskell package mysqlclient and I don't know how to install a C library in Haskell. 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 So please help me, what GHC/package configuration will I need to use MySQL from my Haskell programs on Windows? I really like Haskell but all those "broken" packages are really discouraging. :( Best wishes, Maciej
Marciej, I went the HDBC route and got the same problem. Although it does not seem to be officially blessed, try installing the time-1.1.3 package. It's working for me at least, which I know is a dubious recommendation. Also, I am currently using the hdbc-odbc package for accessing MySQL. I couldn't get hdbc-mysql to work properly. I hope that once I get this project working right, I'll have a chance to dig into the hdbc-mysql issue itself. Good luck! Michael On Fri, Jun 19, 2009 at 12:26 AM, Maciej Podgurski < maciej.podgurski@googlemail.com> wrote:
Hello,
I'm trying to use MySQL from Haskell but it seems impossible for me to install one of the MySQL packages on my Windows XP machine.
First I tired to install hsql-mysql-1.7.1 on GHC 6.10.3 but installing haskelldb-hsql failed with a hidden package error. So I added the old-time package to the cabal file but there still was a compile error (something due to the change from Exception to Exception e => e).
So I switched to GHC 6.8.3 and tried it again. Now it says:
Configuring hsql-mysql-1.7.1... Warning: 'extra-lib-dirs: /usr/lib/mysql' directory does not exist. Warning: 'include-dirs: /usr/include/mysql' directory does not exist. Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package process-1.0.0.1 requires filepath-1.1.0.0 package directory-1.0.0.1 requires filepath-1.1.0.0 package Cabal-1.6.0.3 requires filepath-1.1.0.2 Setup: Missing dependency on a foreign library: * Missing C library: mysqlclient This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
There's no Haskell package mysqlclient and I don't know how to install a C library in Haskell. 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
So please help me, what GHC/package configuration will I need to use MySQL from my Haskell programs on Windows? I really like Haskell but all those "broken" packages are really discouraging. :(
Best wishes, Maciej _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Marciej,
I went the HDBC route and got the same problem. Although it does not seem to be officially blessed, try installing the time-1.1.3 package. It's working for me at least, which I know is a dubious recommendation.What worked for me :
1) Install GHC 6.10.3 from the binary tarball 2) Intall the haskell platform. ( not without problems, sadly ) 3) cabal install HDBC-mysql voilà. That worked both on Kubuntu 9.04 and on Centos 5.3 On kubuntu it was a pain in the .... to figure out which files were needed for opengl. I had to make a symlink by hand. ( opengl was built by the haskell platform ) On centos 5.3 ... libedit was the problem, but once the haskell platform is installed, cabal install hdbc-mysql works like a charm. David.
The same with me - I'm on XP, and HDBC-odbc is the library I got running to access the MySQL database. Regards, Daniel Michael Snoyman schrieb:
Marciej,
I went the HDBC route and got the same problem. Although it does not seem to be officially blessed, try installing the time-1.1.3 package. It's working for me at least, which I know is a dubious recommendation.
Also, I am currently using the hdbc-odbc package for accessing MySQL. I couldn't get hdbc-mysql to work properly. I hope that once I get this project working right, I'll have a chance to dig into the hdbc-mysql issue itself.
Good luck!
Michael
On Fri, Jun 19, 2009 at 12:26 AM, Maciej Podgurski
mailto:maciej.podgurski@googlemail.com> wrote: Hello,
I'm trying to use MySQL from Haskell but it seems impossible for me to install one of the MySQL packages on my Windows XP machine.
First I tired to install hsql-mysql-1.7.1 on GHC 6.10.3 but installing haskelldb-hsql failed with a hidden package error. So I added the old-time package to the cabal file but there still was a compile error (something due to the change from Exception to Exception e => e).
So I switched to GHC 6.8.3 and tried it again. Now it says:
Configuring hsql-mysql-1.7.1... Warning: 'extra-lib-dirs: /usr/lib/mysql' directory does not exist. Warning: 'include-dirs: /usr/include/mysql' directory does not exist. Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package process-1.0.0.1 requires filepath-1.1.0.0 package directory-1.0.0.1 requires filepath-1.1.0.0 package Cabal-1.6.0.3 requires filepath-1.1.0.2 Setup: Missing dependency on a foreign library: * Missing C library: mysqlclient This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
There's no Haskell package mysqlclient and I don't know how to install a C library in Haskell. 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
So please help me, what GHC/package configuration will I need to use MySQL from my Haskell programs on Windows? I really like Haskell but all those "broken" packages are really discouraging. :(
Best wishes, Maciej _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
------------------------------------------------------------------------
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Does Database.HDBC.getTables work for you? I successfully created a new table and selected data from a database but getTables always returns an empty list (what is not a big problem since a query "show tables" works fine). Besh wishes, Maciej W dniu 19.06.2009 13:50 Daniel van den Eijkel pisze:
The same with me - I'm on XP, and HDBC-odbc is the library I got running to access the MySQL database. Regards, Daniel
Michael Snoyman schrieb:
Marciej,
I went the HDBC route and got the same problem. Although it does not seem to be officially blessed, try installing the time-1.1.3 package. It's working for me at least, which I know is a dubious recommendation.
Also, I am currently using the hdbc-odbc package for accessing MySQL. I couldn't get hdbc-mysql to work properly. I hope that once I get this project working right, I'll have a chance to dig into the hdbc-mysql issue itself.
Good luck!
Michael
Hi Maciej, Database.HDBC.getTables works fine here (XP, ghc 6.10.2, HDBC-2.1.0, HDBC-ODBC-2.1.0.0) - it gives me the list of all tablenames, as intended. Which HDBC version do you use? best regards, daniel Maciej Podgurski schrieb:
Does Database.HDBC.getTables work for you? I successfully created a new table and selected data from a database but getTables always returns an empty list (what is not a big problem since a query "show tables" works fine).
Besh wishes, Maciej
W dniu 19.06.2009 13:50 Daniel van den Eijkel pisze:
The same with me - I'm on XP, and HDBC-odbc is the library I got running to access the MySQL database. Regards, Daniel
Michael Snoyman schrieb:
Marciej,
I went the HDBC route and got the same problem. Although it does not seem to be officially blessed, try installing the time-1.1.3 package. It's working for me at least, which I know is a dubious recommendation.
Also, I am currently using the hdbc-odbc package for accessing MySQL. I couldn't get hdbc-mysql to work properly. I hope that once I get this project working right, I'll have a chance to dig into the hdbc-mysql issue itself.
Good luck!
Michael
Hi Daniel, I use HDBC-2.1.1 + HDBC-odbc-2.1.0.0 with GHC 6.8.3 and MySQL Server 5.1 on XP. The hsql equivalent Database.HSQL.tables works as expected. Best wishes, Maciej W dniu 20.06.2009 01:16 Daniel van den Eijkel pisze:
Hi Maciej,
Database.HDBC.getTables works fine here (XP, ghc 6.10.2, HDBC-2.1.0, HDBC-ODBC-2.1.0.0) - it gives me the list of all tablenames, as intended. Which HDBC version do you use?
best regards, daniel
Maciej Podgurski schrieb:
Does Database.HDBC.getTables work for you? I successfully created a new table and selected data from a database but getTables always returns an empty list (what is not a big problem since a query "show tables" works fine).
Besh wishes, Maciej
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
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
participants (6)
-
Björn Peemöller -
Daniel van den Eijkel -
david48 -
John Goerzen -
Maciej Podgurski -
Michael Snoyman