18 December 2008

Ruby's native postgres gem on Windows

The ruby-postgres gem is a compiled and fast adapter. It has some dependencies for Windows, though, so follow these steps to get it running properly:

  1. go to the http://www.postgresql.org/ftp/binary/ and navigate to the release that matches the Postgres server that you installed.
  2. look for and download a file that follows the pattern postgresql-8.X-binaries-no-installer.zip where the X corresponds to the database release
  3. unzip the file and navigate to its bin subdirectory
  4. copy the following files into your ruby installation's bin directory
    • comerr32.dll
    • krb5_32.dll
    • k5sprt32.dll
    • libeay32.dll
    • libpq.dll
    • libiconv2.dll
    • libintl3.dll
    • ssleay32.dll
    • gssapi32.dll
  5. after you have done all that, you should be able to open an interactive ruby session (irb) and type require 'postgres' and get 'true' as a result, i.e., a non-error

No comments:

Post a Comment