HDBC FAQs
HDBC FAQsBuilding SQLite driver on Windows (with GHC)Short version.Long version.How do I upgrade from version 1.0?Building HDBC-PostgreSQL on Windows
Building SQLite driver on Windows (with GHC)
Short version.
Put "sqlite3.h" from sqlite-source-3*.zip into `ghc --print-libdir`/include.
Put "sqlite3.dll" from sqlitedll-3*.zip into ghc --print-libdir and into %windir%\system32.
Proceed with building HDBC and HDBC-Sqlite.
Long version.
First, we need the "sqlite3.h" file. We should obtain it from the SQLite sources prepared specifically for the MS-Windows platform. Go to http://sqlite.org/download.html and check for "sqlite-source-${current version}.zip" - it has an explanation beside it "_This file is provided as a service to MS-Windows users who lack the build support infrastructure of Unix_".From command line we can download it like this:
"c:\Program Files\Internet Explorer\iexplore.exe" http://sqlite.org/sqlite-source-3_3_13.zip
Now we have to find out, where to put the "sqlite.h". Issue:
ghc --print-libdir
and we get the location where the GHC is installed. On my system this location is "c:/Programs/ghc". Your mileage may vary. Let's denote this location as $GHC_HOME. Now, we should put "sqlite3.h" under "$GHC_HOME/include/". To extract it from the zip file we can use the build-in support for zip files in MS-Windows:
explorer sqlite-source-3_3_13.zip
Now copy "sqlite3.h", enter "$GHC_HOME/include" in the Address field, available at the top of the Exloprer window (or otherwise navigate to "$GHC_HOME/include") and paste. Next we need to do the same with the SQLite dynamic link library. While at http://sqlite.org/download.html, search for the "_Precompiled Binaries For Windows_" section, and there for the sqlitedll-${current version}.zip, annotated as "_This is a DLL of the SQLite library without the TCL bindings_". Fetch it. From command line it is possible with:
"c:\Program Files\Internet Explorer\iexplore.exe" http://sqlite.org/sqlitedll-3_3_13.zip
And unpack (copy+paste) the "sqlite3.dll" file, contained within, into two locations: into "$GHC_HOME" and into "%windir%\system32". We need "sqlite3.dll" in the "$GHC_HOME" for gcc to find it, and we need "sqlite3.dll" in "%windir%\system32" in order for Windows linker to find it during the execution of your programs.
Now we are set for the usual installation of HDBC.
Proceed to http://software.complete.org/hdbc/downloads and fetch the latest source release.Plenty of archivers will unpack the ".tar.gz" file. For example, both 7-Zip and WinRAR will unpack it. Alternative file managers, like the Total Commander, can be used to unpack it. Or you can setup the Tar archiver itself from GnuWin32.
Having unpacked the "hdbc" directory from that archive, go into it, and ivoke:
runghc Setup.lhs configure runghc Setup.lhs build runghc Setup.lhs installNow we need to install the HDBC-SQLite driver similarly.
Fetch the latest source release of HDBC-SQLite from http://software.complete.org/hdbc-sqlite3/downloads.
Unpack and go into the "hdbc-sqlite3" from the archive.
Invoke:
runghc Setup.lhs configure runghc Setup.lhs build runghc Setup.lhs installTest that it works. Go into the "hdbc-sqlite3/testsrc" folder, and:
ghc --make runtests.hs runtests.exeYou should see:
+------------------------------------------------------------------------- | Testing HDBC database module: sqlite3, bound to client: 3.3.13 | Proxied driver: sqlite3, bound to version: 3.3.13 | Connected to server version: 3.3.13 +------------------------------------------------------------------------- Cases: 38 Tried: 38 Errors: 0 Failures: 0
The earlier (and less verbose) version of this instruction is available at haskell-cafe
How do I upgrade from version 1.0?
See MigrationFrom10
Building HDBC-PostgreSQL on Windows
This information is out of date
To build on Windows, you must specify where the postgresql include and library files are. Follow these two steps: 1. Ensure the files are NOT installed in a directory with spaces in the name (e.g. "C:\Program Files"). For example, install them in c:\pgsql.1. Assuming postgresql is installed in C:\pgsql, add the following information to the .cabal file:
include-dirs: C:\pgsql\include, C:\pgsql\include\server, . extra-lib-dirs: C:\pgsql\bin
Notice the "." at the end of include-dirs to ensure the current directory is also searched. Also notice "bin" directory is specified in "extra-lib-dirs." This is important in the next step.
1. HDBC-postgresl depends on "libpa.dll" in the bin directory above. The .cabal file refers to the "pq", but that doesn't work on Windows. Change it to libpq like so:
Extra-Libraries: libpq