Installing SQLite3 on windows

I need to do some lightweight code testing so I decided to install
sqlite3 in my laptop (MS-WinXPproSP2) rather than have to create
PostgreSQl DBs. I installed the three required files (sqlite3.def,
sqlite3.exe, and sqlite3.dll) into the same directory as the ruby.exe,
which is on the path. I also installed the sqlite-ruby gem.

In my project root, when I type rake db:create I get this error thrown:

invert> rake db:create --trace
(in C:/Documents and Settings/byrnejb/My Documents/My
Projects/ca.harte-lyne.s
tem/invert)
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:create
rake aborted!
no such file to load – sqlite3
c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_o ginal_require' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequi

c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
pendencies.rb:496:in require' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ pendencies.rb:342:innew_constants_in’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
pendencies.rb:496:in require' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ re_ext/kernel/requires.rb:7:inrequire_library_or_gem’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
re_ext/kernel/reporting.rb:11:in silence_warnings' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ re_ext/kernel/requires.rb:5:inrequire_library_or_gem’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/co
ection_adapters/sqlite3_adapter.rb:10:in sqlite3_connection' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/co ection_adapters/abstract/connection_specification.rb:291:insend’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/co
ection_adapters/abstract/connection_specification.rb:291:in
connection=' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/co ection_adapters/abstract/connection_specification.rb:259:inretrieve_connecti

c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/co
ection_adapters/abstract/connection_specification.rb:78:in connection' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:36 ncreate_database’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:30
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
call' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:inexecute’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
each' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:inexecute’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in
invoke_w h_call_chain' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:insynchron
e’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
invoke_w h_call_chain' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:ininvoke’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in
invoke_ sk' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:intop_lev

c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
each' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:intop_lev

c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standar exception_handling' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:intop_lev

c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in
run' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:instandar
exception_handling’
c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in
run' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 c:/usr/lib/ruby/bin/rake:19:inload’
c:/usr/lib/ruby/bin/rake:19

invert>
invert> dir \usr\lib\ruby\bin\sql*
Volume in drive C has no label.
Volume Serial Number is 6DC8-12AF

Directory of C:\usr\lib\ruby\bin

2008 Feb 06 10:04 3,153 sqlite3.def
2008 Feb 06 10:04 431,163 sqlite3.dll
2008 Feb 06 10:04 439,292 sqlite3.exe
2007 Dec 14 10:48 11,200 sqlsh.rb
4 File(s) 884,808 bytes
0 Dir(s) 74,278,727,680 bytes free

invert>

What am I missing?

James B. wrote:

What am I missing?

gem uninstall sqlite-ruby

gem install sqlite3-ruby

da-ta!

James B. wrote:

gem uninstall sqlite-ruby

gem install sqlite3-ruby

Thank you! That was very helpful.

I got the same error as James and then I tried to run

gem uninstall sqlite-ruby

gem install sqlite3-ruby

as per your suggestions, but I get following error:

C:\Documents and Settings\Arpit\Desktop\Denali\denali>gem uninstall
sqlite-ruby
ERROR: While executing gem … (Gem::InstallError)
Unknown gem sqlite-ruby >= 0

C:\Documents and Settings\Arpit\Desktop\Denali\denali>
C:\Documents and Settings\Arpit\Desktop\Denali\denali>gem install
sqlite3-ruby
Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby
checking for fdatasync() in rt.lib… no
checking for sqlite3.h… no

nmake
‘nmake’ is not recognized as an internal or external command,
operable program or batch file.

Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1
.2.4 for inspection.
Results logged to
c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_
api/gem_make.out

Please let me know what I can do ? I tried to copy sqlite3.dll file from
web and pasted in my config folder

Thanks in advance.

Matt Gregory wrote:

James B. wrote:

gem uninstall sqlite-ruby

gem install sqlite3-ruby

Thank you! That was very helpful.

Arpit Gup wrote:

Please let me know what I can do ? I tried to copy sqlite3.dll file from
web and pasted in my config folder

Probably not a good idea. Can you confirm that you have sqllite3 itself
installed ad working? And please post the output from ‘gem list’ and
‘gem environment’.

James B. wrote:

Arpit Gup wrote:

Please let me know what I can do ? I tried to copy sqlite3.dll file from
web and pasted in my config folder

Probably not a good idea. Can you confirm that you have sqllite3 itself
installed ad working? And please post the output from ‘gem list’ and
‘gem environment’.

I did following and it worked:

  1. I downloaded sqlite3 dll zip from
    http://www.sqlite.org/sqlitedll-3_6_12.zip and unzipped into C:\ruby\bin
    and then ran
  2. gem install sqlite3-ruby -v 1.2.3

Thanks.