Rake db:create failing

Hi everyone,

First of all, I’m running Mac OS X Snow Leopard.

Trying to set up a new SQLite database, but when I run rake db:create,
I get the following huge message:

unable to open database file
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
sqlite3_adapter.rb:13:in initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ sqlite3_adapter.rb:13:innew’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
sqlite3_adapter.rb:13:in sqlite3_connection' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ abstract/connection_pool.rb:223:insend’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_pool.rb:223:in new_connection' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ abstract/connection_pool.rb:245:incheckout_new_connection’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_pool.rb:188:in checkout' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ abstract/connection_pool.rb:184:inloop’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_pool.rb:184:in checkout' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/monitor.rb:242:insynchronize’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_pool.rb:183:in checkout' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ abstract/connection_pool.rb:98:inconnection’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_pool.rb:326:in retrieve_connection' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/ abstract/connection_specification.rb:123:inretrieve_connection’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
abstract/connection_specification.rb:115:in connection' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:43:increate_database’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:31
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in call' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:inexecute’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:inexecute’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/monitor.rb:242:insynchronize’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:ininvoke’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in invoke_task' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:intop_level’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:intop_level’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
standard_exception_handling' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:intop_level’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:instandard_exception_handling’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/rake-0.8.3/bin/rake:31 /usr/bin/rake:19:inload’
/usr/bin/rake:19
Couldn’t create database for {“timeout”=>5000, “adapter”=>“sqlite3”,
“database”=>“db/development.sqlite3”, “pool”=>5}

“unable to open database file” seems like a strange error message to
me because I’m not opening an existing one, I’m creating a new one.
Any idea what could be going on here or how I can fix it?

Thanks for your help.

On 28 June 2010 20:49, Joe [email protected] wrote:

Couldn’t create database for {“timeout”=>5000, “adapter”=>“sqlite3”,
“database”=>“db/development.sqlite3”, “pool”=>5}

Just a guess, could it be a permissions issue? Do you have write
permission in that folder?

Colin

I know this will sound a little silly but do you have a db directory
just
below the application root? Rails should have created it.

Do you have permission to access that directory?
Do you have permission to create files in that directory?

Maybe the application directory was created by a different user to the
user
who is running the db:create

Does the file db/development.sqlite3 already exist?
What permissions does it have?

If it does not already exist what happens when you do this from the
application root

$ touch db/development.sqlite3

It should just create the file for you.

I’ve had an issue with the sqlite driver. What version are you using?
Looking at the RubyForge site, they’ve released version 1.3.0 of
sqlite3-ruby on June 6th - upgrading this might help