How to get SQLite3, Cygwin and Rails to work together

UPDATE (26 Apr 2007) - You may like to try the following steps Add the repository for the Cygwin Ports project to your list of URLs in the Cygwin Setup program (ftp://sunsite.dk/projects/cygwinports). Then, under the 'Devel' category, add sqlite3 and sqlite3-devel. Once you're done installing (it may update a few other packages as well, depending on what you've installed) you can simply go `gem install sqlite3-ruby` (with the ruby version) and you're done! More information here Thanks to Charles Roper and pnomolos

Another way

Here's the procedure I took to get SQLite3 and Ruby on Rails to work on my Windows XP Cygwin environment. This article refers to the following software versions



ruby 1.8.5 (2006-08-25) [i386-cygwin]

sqlite version 3.3.8

sqlite3-ruby (1.1.0) Ruby gem

rails (1.1.6) Ruby gem


Install Cygwin and Rails as described here. Then, download the sqlite3 sources from the SQLite download page. I compiled the 3.3.8 version from the source tarball.


wget http://www.sqlite.org/sqlite-3_3_8.zip


Extract the tarball and read the README for compilation instructions. You will need to install GCC and Make using the Cygwin installer. After compilation you will have sqlite3.exe. You will also need to build the .dll. In the sqlite source directory type


make sqlite3.dll


The copy the .dll and the .exe to somewhere on your path, eg:


cp sqlite3.exe sqlite3.dll ~/bin


Now install the sqlite3-ruby gem (choosing the latest mswin32 version)


gem install sqlite3-ruby


You have to make a change to this file


c:/cygwin/lib/ruby/gems/1.8/gems/ \ 

  sqlite3-ruby-1.1.0-mswin32/lib/sqlite3/driver/dl/


So that it reads


when /win32/, /i386-cygwin/

  "sqlite3.dll"


And you should be able to specify sqlite3 as the database in your database.yml, for example :


development:

  adapter: sqlite3

  database: db/residence_development.db


Comments? Please