5

I am new to Sinatra and I am trying to make a database using SQLite3 and Datamapper. I installed both gems and also the adaptor and then tried to execute this code in a file:

#config
require 'sinatra'
require 'sinatra/contrib' if development?
require 'data_mapper'

DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")  
DataMapper.finalize.auto_upgrade!  

The command line gave me this error when I executed the file:

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found.   - 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)

and then a lot of other things which went wrong because of these errors. I tried reinstalling many of the gems but nothing seems to have worked.

EDIT: The full error code was this:

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found.   - C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:31:in `rescue in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:26:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter/adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:230:in `setup'
from test.rb:7:in `<main>'
3
  • 3
    Did you try to install dm-sqlite-adapter gem? Dec 22, 2012 at 13:19
  • 1
    Can you provide the full stacktrace and the command you used?
    – mbj
    Dec 22, 2012 at 13:30
  • I have already installed dm-sqlite-adapter. The error still occurs. The command I used was "ruby test.rb". I am not sure how I can find the stacktrace.
    – Amja
    Dec 22, 2012 at 13:33

2 Answers 2

7

I had this problem, using ruby 1.9.3 on windows - fixed it by downloading the sqlite3.dll from http://www.sqlite.org/download.html and putting it in C:\Ruby193\bin

0
2

Try adding:

require 'dm-sqlite-adapter'

If that doesn't fix things, you could also try changing

DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")

to

DataMapper.setup(:default, 'sqlite:recall.db')

and see if that fixes it. I really don't know the cause, but doing the above (single quotes, no "3", and no path) fixed an error I was receiving when trying a particular setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.