Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to connect my Rails app to an EC2 instance that contains a PG database. I've already checked with Navicat that I can connect to the database given the EC2 details. The issue is that when run locally the Rails app can't be viewed; it throws the error "database configuration does not specify adapter". A similar issue is thrown when I try a database migration. I haven't even tried to push this up to my Rails EC2 since it isn't working locally.

My database.yml file looks like this:

production:
 adapter: postgresql
 encoding: unicode
 database: postgres
 host: ec2-54-197-115-117.compute-1.amazonaws.com
 pool: 10
 port: 5432 (have both included and removed this line)
 username: a database username for security
 password: the password associated with that user

My gem files include the gem pg.

For the database name I just wrote what it had in Navicat, but perhaps there's an official name associated with it I should be using; if so, how would I find it? The host I got from the EC2 details. And the username and password were the ones I set with the postgres database via unix.

Thanks in advance for any insight!

Edit:

Fixed!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Fixed! I had forgotten to create an actual DB after setting up the PG; I changed the name in my database.yml file to reflect the new db name. Also, I needed to set on my Rails app environment directly (I thought Apache did this automatically w/Passenger) with "export RAILS_ENV=production". I thought it was still broken when I restarted my server and nothing had changed, but I just had to restart the console. Hope this helps someone else out too!

share|improve this answer
1  
Thanks for submitting the solution - it helped me big-time! To get mine to work, I had to add the name of the db to the hostname to make it work; in other words, in the RDS management console, the "Endpoint" was "staging.blabla.eu-west-1.amazonaws.com:5432". I removed the :5432 part, but left in "staging.", which is the name of my database. Just FWIW! –  Dan Laffan Jan 17 at 23:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.