database.yml and sqlite3 errors

I'm going by the tutorial at <http://www.sitepoint.com/article/ruby-on-

but am having problems with the database.yml file, I believe.

This may be due to my using a different platform than the author. I've tried a few different variations on the database.yml file, here's what I currently have:

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ ShoppingList/script/generate controller ListItems /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/ connection_adapters/abstract/connection_specification.rb:208:in `establish_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/ connection_specification.rb:202:in `establish_connection'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ active_record/connection_adapters/abstract/ connection_specification.rb:195:in `establish_connection'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:235:in `initialize_database'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:92:in `process'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `send'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `run'         from ./ShoppingList/script/../config/../config/environment.rb:13         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/ generate.rb:1         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from ShoppingList/script/generate:3 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ ll ShoppingList/storage.db -rw-r--r-- 1 thufir users 2048 Nov 23 03:09 ShoppingList/storage.db thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat ShoppingList/config/database.yml -n      1      2 development:      3 tadapter: sqlite3      4 database: storage.db      5      6 test:      7 adapter: sqlite3      8 database: storage-test.db      9     10 production:     11 adapter: sqlite3     12 database: storage.db thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat /etc/gentoo-release Gentoo Base System release 1.12.9 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ date Fri Nov 23 03:10:24 PST 2007 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $

thanks,

Thufir

This is how the author has it:

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ ShoppingList/script/generate controller ListItems /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 2, col 10: ` tadapter: sqlite3' (ArgumentError)         from /usr/lib/ruby/1.8/yaml.rb:133:in `load'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:551:in `database_configuration'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:234:in `initialize_database'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:92:in `process'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `send'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `run'         from ./ShoppingList/script/../config/../config/environment.rb:13         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/ generate.rb:1         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from ShoppingList/script/generate:3 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat ShoppingList/config/database.yml

development:         tadapter: sqlite3         database: db/storage.db

test:         adapter: sqlite3         database: db/storage-test.db

production:         adapter: sqlite3         database: db/storage.db thufir@arrakis ~/rubyCode $

thanks,

Thufir

You don't want that t in front of adapter.

Fred

Thank you. Same error, though :frowning:

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat -n ShoppingList/config/database.yml      1      2 development:      3 adapter: sqlite3      4 database: db/storage.db      5      6 test:      7 adapter: sqlite3      8 database: db/storage-test.db      9     10 production:     11 adapter: sqlite3     12 database: db/storage.db thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ ShoppingList/script/generate controller ListItems /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 2, col 9: ` adapter: sqlite3' (ArgumentError)         from /usr/lib/ruby/1.8/yaml.rb:133:in `load'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:551:in `database_configuration'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:234:in `initialize_database'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:92:in `process'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `send'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `run'         from ./ShoppingList/script/../config/../config/environment.rb:13         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/ generate.rb:1         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from ShoppingList/script/generate:3 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ date Fri Nov 23 10:22:28 PST 2007 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $

thanks,

Thufir

I'm also trying mysql:

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ ShoppingList/script/generate controller ListItems /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 3, col 0: ` database: shopping_development' (ArgumentError)         from /usr/lib/ruby/1.8/yaml.rb:133:in `load'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:551:in `database_configuration'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:234:in `initialize_database'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:92:in `process'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `send'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/ initializer.rb:47:in `run'         from ./ShoppingList/script/../config/../config/environment.rb:13         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/ generate.rb:1         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'         from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from ShoppingList/script/generate:3 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat -n ShoppingList/config/database.yml      1      2 development:      3 adapter: mysql      4 database: shopping_development      5 username: root      6 password:      7 host: localhost      8 test:      9 adapter: mysql     10 database: shopping_test     11 username: root     12 password:     13 host: localhost     14     15 production:     16 adapter: mysql     17 database: shopping_production     18 username: root     19 password:     20 host: localhost     21     22 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ mysql --user=root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

<http://www.digitalmediaminute.com/howto/fc4rails/&gt; gives the following database.yml:

development:   adapter: mysql   socket: /var/lib/mysql/mysql.sock   database: contacts   host: localhost   username: root   password: yourPassword

This form makes sense, however, I've seen various entries for the socket. How do you know what to enter for the socket?

thanks,

Thufir

Depends on your database configuration.

find / -type s -name \*sock -print

or ask your database admin.

I took out the tabs so that it's:

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat ShoppingList/config/database.yml

development:         adapter: mysql         database: shopping_development         username: ruby         password: rails         host: localhost         socket: /var/run/mysqld/mysqld.sock test:         adapter: mysql         database: shopping_test         username: ruby         password: rails         host: localhost         socket: /var/run/mysqld/mysqld.sock production:         adapter: mysql         database: shopping_production         username: ruby         password: rails         host: localhost         socket: /var/run/mysqld/mysqld.sock

thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ cat /etc/gentoo-release Gentoo Base System release 1.12.9 thufir@arrakis ~/rubyCode $ thufir@arrakis ~/rubyCode $ date Sat Nov 24 02:47:55 PST 2007 thufir@arrakis ~/rubyCode $

but with no tabs and now it's all good :slight_smile:

thanks,

Thufir