简体   繁体   中英

Ruby on Rails error: Invalid connection “adapter”

I'm using Ruby on Rails ( rails version 2.3.4), and using pg gem (version 0.12.2) on Windows. My database.yml file has the following content:

production:
  adapter: postgresql
  encoding: utf8
  host: localhost
  database: canvas4
  username: canvas
  password: canvas
  port: 5433
  timeout: 5000
  pool: 5
  queue:
    adapter: postgresql
    encoding: utf8
    database: canvas4_queue
    host: localhost
    port: 5433
    username: canvas
    password: canvas
    timeout: 5000
    pool: 5

But when i run command: bundle exec rake db:initial_setup RAILS_ENV=production , the error occurs:

Invalid connection "adapter"

I've also tried with gem "activerecord-postgresql-adapter" but the same error occurs as above.

I can successfully setup with sqlite3 driver.

Do you know how to get postgresql adapter to work with rails 2.3 ?

make sure your db-adapter in database.yml is set to "postgresql". If still you have the same problem, then try using the pure-ruby adapter:

gem install postgres-pr

(make sure you uninstall the pg gem before... to avoid conflicts)

If it works, then it's a problem with the postgres gem. Anyway, for development purposes, using the pure-ruby gem is usually ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM