Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:53:03+00:00 2026-06-13T12:53:03+00:00

I just deployed my production application on heroku. I can still access my staging

  • 0

I just deployed my production application on heroku.

I can still access my staging database with no problems using:

heroku pg:psql --app staging-app

But when I try to do the same thing for production:

heroku pg:psql --app production-app

I get a connection timeout and an error saying that host xxx is not listening on port 5432.

When I go to the heroku website and get the settings for the production database, it shows that it’s running on host yyy (i.e., not xxx). Can anyone tell me how to get the pg:psql command to connect to the correct host?

The web server seems to be connecting to the database with no problems, and if I run:

heroku run --app production-app rails console

then I can see records in the database via ActiveRecord.

BTW, the command:

heroku pg:info --app production-app

Gives these results:

=== HEROKU_POSTGRESQL_MAROON
Plan:        Dev
Status:      available
Connections: 0
PG Version:  9.1.5
Created:     2012-08-08 17:55 UTC
Data Size:   5.9 MB
Tables:      0
Rows:        0/10000 (In compliance)
Fork/Follow: Unavailable

=== SHARED_DATABASE (DATABASE_URL)
Data Size: 600k
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:53:04+00:00Added an answer on June 13, 2026 at 12:53 pm

    Apparently the correct command is:

    heroku pg:psql HEROKU_POSTGRESQL_MAROON --app production-app
    

    So both the database name and the --app parameter are required (for some reason, all the examples of running this command I ran into did one or the other, but not both).

    I’m guessing that the database name is required even when the application is specified because of the presence of the SHARED_DATABASE database (this database is not present in my staging app).

    By the way, I found the answer to this problem when I realized that I was using the now deprecated heroku gem and switched to the heroku toolbelt, which instead of trying to connect to an invalid host and timing out after 60 seconds, actually prints a semi-useful message:

     !    Unknown database. Valid options are: HEROKU_POSTGRESQL_MAROON_URL, SHARED_DATABASE
    

    (I rate it semi-useful because you have to know enough to remove the _URL part from the database name.)


    UPDATE:


    In trying to deploy my application I discovered that things like rake db:setup were not working correctly because they were going to the shared database instead of the postgres database.

    I deprovisioned the shared database (see https://devcenter.heroku.com/articles/migrating-from-shared-database-to-heroku-postgres#3-deprovision-your-shared-database). After doing that I also had to manually set the DATABASE_URL to be the same as HEROKU_POSTGRESQL_MAROON_URL (the documentation seems to imply that that will happen automatically, but in my case it didn’t).

    Now I can run the command

    heroku pg:psql --app production-app
    

    with no problems, and most importantly, my rake tasks operate on the correct database.

    Hope this helps somebody else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just deployed my Rails app to Heroku, but the Javascripts that were using
I just deployed my first django app to the Heroku platform. I basically followed
I've got a ClickOnce application deployed that many machines can install just fine -
I just deployed an application to a new server, and although I'm using virtualenv,
The application I develop is deployed to severeal environments (development, test, staging, production). While
I've just made my Rails app and deployed it to Heroku. A very weird
I just deployed one of my apps to heroku. This app uses : A
I have a web application deployed on heroku. I just introduced Neo4j as data
I've just deployed my app to a VPS and I'm using Rails 3.1.3, with
I just deployed an application using capistrano, nginx and unicorn. I used to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.