Forum: Ruby on Rails database.yml and sqlite3 errors

E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-23 12:24
(Received via mailing list)
I'm going by the tutorial at <http://www.sitepoint.com/article/ruby-on-
rails> 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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2007-11-23 12:28
(Received via mailing list)
On 23 Nov 2007, at 11:21, Thufir wrote:

>     1
>     2  development:
>     3          tadapter: sqlite3
>     4          database: storage.db

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

Fred
E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-23 12:30
(Received via mailing list)
On Fri, 23 Nov 2007 11:21:36 +0000, Thufir wrote:

>  I've
> tried a few different variations on the database.yml file, here's what I
> currently have:

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
E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-23 19:24
(Received via mailing list)
On Fri, 23 Nov 2007 11:27:16 +0000, Frederick Cheung wrote:


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

Thank you.  Same error, though :(


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
E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-23 21:01
(Received via mailing list)
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.

mysql>
mysql> show databases;
+----------------------+
| Database             |
+----------------------+
| information_schema   |
| ShoppingList         |
| dummy_development    |
| dummy_production     |
| dummy_test           |
| feed_on_feeds        |
| mysql                |
| remco                |
| shopping             |
| shopping_development |
| shopping_production  |
| shopping_test        |
| test                 |
+----------------------+
13 rows in set (0.16 sec)

mysql> quit
Bye
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ date
Fri Nov 23 11:59:08 PST 2007
thufir@arrakis ~/rubyCode $





thanks,

Thufir
E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-23 22:13
(Received via mailing list)
<http://www.digitalmediaminute.com/howto/fc4rails/> 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
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2007-11-23 22:50
(Received via mailing list)
On Nov 23, 2007 3:12 PM, Thufir <hawat.thufir@gmail.com> wrote:
>   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?

Depends on your database configuration.

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

or ask your database admin.


--
Greg Donald
http://destiney.com/
E4e17e45f2e8cc967a8695131910f365?d=identicon&s=25 Thufir (Guest)
on 2007-11-24 11:51
(Received via mailing list)
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 :)



thanks,

Thufir
0ab32ac5661d9e24c80882d3bffc6114?d=identicon&s=25 Julix Andres (julix)
on 2008-08-13 22:20
I had the same problem .

it is the solution
Without spaces between any variable.
Ej:
  adapter: mysql
  encoding: utf8
  database: namedb
  username: root
  password: mypassword
  host: localhost
  socket: /var/run/mysqld/mysqld.sock

and later every thing was ok.

if you have errors please contact me juldtb@gmail.com

Blessings !!!
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.