SQLite3::CantOpenException

Hi,

When I try to run a controller that connects to my project’s sqlite
database, I get the following exception:

SQLite3::CantOpenException in PostController#index
could not open database

config/database.yml correctly points to my database, like so:

development:
adapter: sqlite3
database: db/dev.db

I’ve had Rails projects working with sqlite3 before (recently), but
starting any new projects has always lead to this error. I can’t figure
out what’s making the difference between the working and broken
projects…

Here is the full trace:

/usr/lib/ruby/1.8/sqlite3/errors.rb:94:in ‘check’
/usr/lib/ruby/1.8/sqlite3/database.rb:112:in ‘initialize’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in
‘sqlite3_connection’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
‘connection_without_query_cache=’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:in
‘connection=’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in
‘retrieve_connection’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
‘connection’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1046:in
‘add_limit!’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1017:in
‘construct_finder_sql’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in
‘find_every’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in
‘find’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/deprecated_finders.rb:37:in
‘find_all’
#{RAILS_ROOT}/app/controllers/post_controller.rb:4:in ‘index’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
‘perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
‘perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
‘perform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in ‘measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
‘perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
‘perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
‘process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
‘process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
‘process’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
‘dispatch’
/var/www/my-site/blog/dispatch.cgi:10

Other info:

Ruby 1.8.4
Rails 1.1.6
sqlite 3.3.5
sqlite3-ruby 1.1.0
Running on Apache 2.0.55, Ubuntu 6.10

Thanks,
Gavin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs