getting a DB library working with ghc 6.6 and PostgreSQL 7.4.7

I'm looking for an alternative to HSQL for database connectivity -- the lack of prepared statements in HSQL is particularly worrisome. I installed HDBC, but when I tried running a simple program that used it, I get the error message ghc-6.6: /usr/local/lib/HDBC-postgresql-1.0.1.0/ghc-6.6/HSHDBC-postgresql-1.0.1.0.o: unknown symbol `PQserverVersion' Looking more closely at the README.txt file there, it seems that the PostgreSQL driver is expecting 8.1, and I'm using 7.4.7. I installed the ODBC driver, and I know that in theory one can connect to my PostgreSQL server with ODBC, but as far as I can tell from the documentation, I would have to configure a separate DSN for every database instance that I would want to connect to, which makes it kind of useless for a utility that any user could pass database names to on the command line. The takusen package looks interesting, but when I checked it out and tried to build it (with "ghc --make -o setup Setup.hs"), I got the error message Setup.hs:6:7: Could not find module `Distribution.Compat.FilePath': it is hidden (in package Cabal-1.1.6) How do I work around these? Is there another library worth looking into?

I installed HDBC, but when I tried running a simple program that used it, I get the error message
ghc-6.6: /usr/local/lib/HDBC-postgresql-1.0.1.0/ghc-6.6/HSHDBC-postgresql-1.0.1.0.o: unknown symbol `PQserverVersion'
Ah, I figured it out. The PQserverVersion function is documented in the PostgreSQL 8.0 and 8.1 manuals as follows: "Applications may use this to determine the version of the database server they are connected to. The number is formed by converting the major, minor, and revision numbers into two-decimal-digit numbers and appending them together. For example, version 7.4.2 will be returned as 70402, and version 8.1 will be returned as 80100 (leading zeroes are not shown). Zero is returned if the connection is bad." You'd think, from the description, that the libpq for PostgreSQL 7.4 would also have this function. But it doesn't.

On Mon, 16 Oct 2006 23:49:19 -0400, Seth Gordon wrote:
I'm looking for an alternative to HSQL for database connectivity -- the lack of prepared statements in HSQL is particularly worrisome.
I installed HDBC, but when I tried running a simple program that used it, I get the error message
ghc-6.6: /usr/local/lib/HDBC-postgresql-1.0.1.0/ghc-6.6/HSHDBC-postgresql-1.0.1.0.o: unknown symbol `PQserverVersion'
As you noted, HDBC's PostgreSQL backend requires PostgreSQL 8.1 or above. There were major API changes in that version, and I rather would get a driver our there than learn two APIs. I posted a new HDBC today that is tested against GHC 6.6. -- John
participants (2)
-
John Goerzen
-
Seth Gordon