The Ruby on Rails version for Windows does not ship with the Sqlite3 database, although the database.yaml configuration file is preconfigured to use Sqlite.
This is a guide to installing Sqlite3 on your Windows PC. This article assumes that Ruby and Ruby on Rails are already installed on your PC.
First you need to download two files from the Sqlite website http://www.sqlite.org/download.html :
sqlite-3_5_9.zip (214.32 KiB) A command-line program for accessing and modifing SQLite databases. See the documentation for additional information. sqlitedll-3_5_9.zip (213.17 KiB) This is a DLL of the SQLite library without the TCL bindings. The only external dependency is MSVCRT.DLL.
The first file is the Sqlite command-line tool used to modify the Sqlite database. You may or may not use this.
The second file is the Windows DLL file, and Ruby uses this when Rails makes Sqlite database calls.
When both of these ZIP files have been extracted, you should have the following files:
- sqlite3.exe
- sqlite3.def
- sqlite3.dll
Copy these files to the bin directory of your Ruby installation, if you follow the standard Ruby installation, it will be located here:
C:\ruby\bin
Now that you have the Sqlite3 files installed, you need to tell Ruby how to use them. To do this, you need to download the Ruby bindings for Sqlite3. Fortunately, this is easy to do using Ruby gems. Just enter the following command at a command prompt:
gem install sqlite3-ruby
Now you need to tell Gems which version you need, since you will be presented with the following result:
Bulk updating Gem source index for: http://gems.rubyforge.org Select which gem to install for your platform (i386-mswin32) 1. sqlite3-ruby 1.2.2 (mswin32) 2. sqlite3-ruby 1.2.2 (ruby) 3. sqlite3-ruby 1.2.1 (mswin32) 4. sqlite3-ruby 1.2.1 (ruby) 5. Skip this gem 6. Cancel installation >_
Select option 1, sqlite3-ruby 1.2.2 (mswin32). All successful you will get some results as follows:
Successfully installed sqlite3-ruby-1.2.2-mswin32 Installing ri documentation for sqlite3-ruby-1.2.2-mswin32... Installing RDoc documentation for sqlite3-ruby-1.2.2-mswin32...
If you use Rails 2+, you can run the following rake tasks from the Rails application directory. For example, let's say you created a Rails application located here: C: \ MyApp, which you must run:
C:\MyApp>rake db:create or C:\MyApp>rake db:migrate
Good luck
(This was taken verbatim from http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/ )