Search code examples
ruby-on-railsrubysqlitesequel

`require': LoadError: cannot load such file -- sequel/adapters/sqlite3 (Sequel::AdapterNotFound)


I am using Sequel in my Rails application instead of Active Record.

How do I configure it and connect to my database? Currently I am using

DB = Sequel.connect(ENV['DATABASE_URL'])

but I am getting errors:

/home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `require': LoadError: cannot load such file -- sequel/adapters/sqlite3 (Sequel::AdapterNotFound)
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `block in tsk_require'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:100:in `block in check_requiring_thread'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:97:in `synchronize'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:97:in `check_requiring_thread'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `tsk_require'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/database/connecting.rb:25:in `adapter_class'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/database/connecting.rb:55:in `connect'
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:147:in `connect'
    from benchmarks/bm_sequel_create_string_columns.rb:4:in `<main>'

When I do puts ENV['DATABASE_URL'] I get the following output:

sqlite3::memory:

What is the correct way?


Solution

  • The adapter is called sqlite, not sqlite3 when using the Sequel gem.