Rails and Azure: TinyTds::Error: Adaptive Server connection failed - ruby-on-rails

I'm trying to configure my Rails project with SQL on Azure. I'm using Mac OS X 10.11.
This is part of my config/database.yml:
staging:
adapter: sqlserver
mode: dblib
host: db-staging.database.windows.net
port: 1433
database: db-staging
username: myuser#db-staging
password: mypass
timeout: 5000
azure: true
When I run tsql seems like is everything ok:
$ tsql -H db-staging.database.windows.net -U myuser -P 'mypass' -v -p 1433 -D db-staging
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Setting db-staging as default database in login packet
Changed database context to 'db-staging'.
Changed language setting to us_english.
1>
But when I run rake db:migrate I receive this error TinyTds::Error: Adaptive Server connection failed.
Here is the complete trace:
$ rake db:migrate RAILS_ENV=staging --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
TinyTds::Error: Adaptive Server connection failed
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `initialize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:311:in `new'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:311:in `dblib_connect'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:302:in `connect'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:58:in `initialize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/sqlserver_base.rb:17:in `new'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/sqlserver_base.rb:17:in `sqlserver_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:87:in `connection'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:912:in `initialize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `new'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `call'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/Users/monteirobrena/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/gems/2.0.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/Users/monteirobrena/.rvm/gems/ruby-2.0.0-p481/bin/rake:23:in `load'
/Users/monteirobrena/.rvm/gems/ruby-2.0.0-p481/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
I saw other questions like this, but did not help me:
TinyTds::Error: Adaptive Server connection failed
TinyTds Error: Adaptive Server connection timed out
[Updated]
I tried do exactly like here:
https://github.com/Azure/azure-sql-database-samples/tree/master/Ruby%20on%20Rails/Sample%20Mac
Following this post I found the correct configurations to set in my config/database.yml.
https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-ruby-simple-mac-osx/
staging:
adapter: sqlserver
username: 'username#database'
password: 'password'
host: 'db-staging.database.windows.net'
port: 1433
database: 'db-staging'
azure: true
And add this gems im my Gemfile:
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'
Now when I access my project folder and run rails s I can connect with my database and everything work fine. But, if I run my project with Puma and Nginx, I receive this error:
TinyTds::Error (Adaptive Server connection failed):
[/Updated]

I need install FreeTDS by myself, if apt-get we can't pass the arguments of compilation:
wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
$ tar -zxvf freetds-stable.tgz
$ cd freetds-0.91/
$ ./configure --with-tdsver=8.0 --with-openssl=/usr/bin
$ make
$ sudo make install
And now I can access my database:
$ tsql -C # OK!
$ TDSVER=8.0 tsql -H mydb.database.windows.net -p 1433 -U myuser#mydb -P mypassword -D mydb
And everything works when I run and access with Puma, Nginx and Capistrano.
See more here:
https://github.com/rails-sqlserver/tiny_tds/issues/266

Related

rake db commands not working on production server

I've just set up my production server with a postgres db, change the env to production and run bundle install --deployment. I have also set up the postgres user on my server and created the necessary db.
When I run rake db:schema:load I get the following error:
$ rake db:schema:load
-- enable_extension("plpgsql")
rake aborted!
PG::ConnectionBad: FATAL: Peer authentication failed for user "Javu"
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in `new_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in `retrieve_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:87:in `connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:646:in `connection'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:661:in `block in method_missing'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/home/rails/db/schema.rb:17:in `block in <top (required)>'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/schema.rb:41:in `instance_eval'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/schema.rb:41:in `define'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/schema.rb:61:in `define'
/home/rails/db/schema.rb:14:in `<top (required)>'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:218:in `load_schema_for'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:235:in `block in load_schema_current'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:274:in `each'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:234:in `load_schema_current'
/home/rails/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:244:in `block (3 levels) in <top (required)>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
rake db:migrate, rake db:create and rake db:drop returned similar errors.
My database.yml file looks like this:
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: example_developement
password: ~
user: Javu
production:
<<: *default
database: example_production
user: postgres
host: localhost
test:
database: example_test
What do I have to do to fix this error and make the schema load work?
Looks like your database isn't configure to let your user access it. Take Rails out of the equation and using psql try to connect to the database using the information in your database.yml file. So something like...
psql -h localhost -U example_production
Get that working. Then Rails should be okay. You may need to tweak PostgreSQL or your database.yml so they agree on user/password/host settings.
Since the error returned suggests that you're trying to log in with the wrong user, the issue here seems to be that you aren't setting the Rails environment correctly.
Try running the command like this RAILS_ENV=production bundle exec rake db:schema:load.

Rails: Postgres + rake db:structure:dump using wrong user

I'm trying to dump the structure of my remote database using rake's rake db:structure:dump, but whenever I run that command it ignores the user in my database.yml file and uses the user on my local machine that I'm logged in as.
Database.yml:
development: &DEFAULT
adapter: postgresql
host: remoteaddress.com
port: 5432
user: myusername
password: mypassword
database: mydatabase
This is what happens when I run the command:
[~/src/myapp]$ RAILS_ENV=development rbbe rake db:structure:dump --trace ✭ git:em-redshift ruby:2.2.0
** Invoke db:structure:dump (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:structure:dump
pg_dump: [archiver (db)] connection to database "mydatabase" failed: FATAL: password authentication failed for user "emai"
FATAL: password authentication failed for user "emai"
rake aborted!
Error dumping database
/opt/rubies/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'
/opt/rubies/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:182:in `structure_dump'
/opt/rubies/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:276:in `block (3 levels) in <top (required)>'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rubies/2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/opt/rubies/2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/opt/boxen/rbenv/versions/2.2.0/bin/rake:33:in `<main>'
Tasks: TOP => db:structure:dump
As you can see, it doesn't use myusername as the user. Instead it runs it as my local user (emai). What is going on?
P.S. I know the db config works too, because I went into the rails console and queried for records and got results. Also, rake db:schema:dump works with no authentication errors.
After looking into the docs (https://github.com/rails/rails/blob/master/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb), you need to add a username key to get it to work... seriously...
development: &DEFAULT
adapter: postgresql
host: remoteaddress.com
port: 5432
user: myusername
username: myusername <-------
password: mypassword
database: mydatabase
Jsut replace user with username.

Why is Rake aborting because of "Bad file Descriptor"?

I have a problem creating a database using rake db:create.
I followed the "Fat Free CRM Guides: Installation on Microsoft Windows" guide to install the Fat Free CRM on Windows.
I am on 32-bit Windows 7. Rake is 0.8.7. RubyGems is 2.0.3 and Ruby is 1.9.3. I am using MySQL2 v0.2.6.
The error I got was:
C:\RailsInstaller\fat_free_crm>rake db:create RAILS_ENV=production --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:create
rake aborted!
Bad file descriptor
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:629:in `configure_connecti
on'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:169:in `initialize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connectio
n'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_
connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 leve
ls) in checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in chec
kout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in conn
ection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_conn
ection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retr
ieve_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `conn
ection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:120:in `rescue in create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:85:in `create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:62:in `block (3 levels) in <top (required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:62:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:62:in `block (2 levels) in <top (required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/applic....
C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `load'
C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `<main>'
Tasks: TOP => db:create
C:\RailsInstaller\fat_free_crm>[/code]
I changed libmysql.dll for win7 - 32bit
The configuration of database.yml is:
development:
adapter: mysql2
encoding: utf8
database: fat_free_crm_development
pool: 5
username: root
password: ale
#socket: /var/run/mysqld/mysqld.sock
host: localhost
#host: 127.0.0.1
port: 3306
test:
#<<: *development
database: fat_free_crm_test
production:
#<<: *development
adapter: mysql2
encoding: utf8
#database: crm_production
database: fat_free_crm_production
pool: 5
username: root
password: ale
#socket: /tmp/mysql.sock
#host: 127.0.0.1
host: localhost
port: 3306
staging:
#<<: *development
database: fat_free_crm_staging
Does anyone have any ideas?
At lines 9, 25, 29, 43 remove &development and <<*development. I think you have syntax errors in your database.yml file.

Rails rake aborted! can't convert Hash into String

Ok i had this working and i'm not sure what i could have changed to make rake db:create not working now. I ran rake db:drop to drop my db so i can start from scratch and now rake db:create is having a problem.
Here's my stacktrace below. I'm not sure how to go about troubleshooting this.
$ rake db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
can't convert Hash into String
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/mysql2_adapter.rb:17:in `new'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/mysql2_adapter.rb:17:in `mysql2_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in `new_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `loop'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `block in checkout'
/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in `checkout'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in `connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `retrieve_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:86:in `rescue in create_database'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:54:in `create_database'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/bin/rake:19:in `load'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/bin/rake:19:in `<main>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/bin/ruby_noexec_wrapper:14:in `eval'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327#famnfo/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:create
database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: mysql2
encoding: utf8
database: FamNFo_development
# local
username: root
password:
# server
# username: famnfo_dev
# password: Panther89!1
# local
socket: /tmp/mysql.sock
# server
# socket: /var/lib/mysql/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
database: FamNFo_test
# local
# username: root
# password:
# server
username: root
password:
# local
socket: /tmp/mysql.sock
# server
#socket: /var/lib/mysql/mysql.sock
production:
adapter: mysql2
encoding: utf8
database: FamNFo_production
# local
# username: root
# password:
# server
username: myusername
password: mypassword
# local
# socket: /tmp/mysql.sock
# server
socket: /var/lib/mysql/mysql.sock
When you have extra leading spaces before a key in your YAML file it is interpreted as a sub-key, and thus the upper key is interpreted as a hash instead of a string. So removing the extra space before socket in the test section should fix the problem.

In ruby rake db:migrate show the password failure

I am using rails with postgresql which is on remote machine. I have edited database.yml file according to the requirement.but when i run rake db:migrate it shows password failure.. but the same password works with the psql command..
the error when i run rake db:migrate is:
root#vdimc04 My_Postgres]# rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
fe_sendauth: no password supplied
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `connect'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:326:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/migration.rb:662:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/migration.rb:570:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/migration.rb:570:in `up'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/migration.rb:551:in `migrate'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:179:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate
** my database.yml file**
development:
adapter: postgresql
encoding: unicode
database: db_pchamara
pool: 5
username: db_test_user
password: password
host: 192.168.1.101
port: 5432
test:
adapter: postgresql
encoding: unicode
database: db_pchamara_test
pool: 5
username: db_test_user
password: password
production:
adapter: postgresql
encoding: unicode
database: db_pchamara_production
pool: 5
username: db_test_user
password: password
Guys I got answer to my question...
When we start a new project with rails command like 'rails new demo' we have to include '--database=postgresql'. Then only the pg gem will gets to the bundle.. If it is not declared the pg gem will not comes to bundle..
And what i did in database.yml file is also correct. Everything is fine there...
When we use the database of postgresql to rails, we have to make some modifications to pg_hba.conf that is located in the lib directory..
I made some modifications there at my ip to TRUST where before it is md5..
we Can use both TRUST and md5.
md5- requires a passowrd to connect to database
trust- not requires a password
thats it.. as ususal include password to database.yml file.
Now the server runs without any error...
THANKS TO EVERYONE WHO HELPED ME TO FIGURE OUT THIS PROBLEM

Resources