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 8037437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:55:45+00:00 2026-06-05T02:55:45+00:00

I am running a Ruby on Rails app on Heroku. It uses a Postgres

  • 0

I am running a Ruby on Rails app on Heroku. It uses a Postgres database. I want to connect to the database from some scripts I am writing and running locally.

Using ENV[‘DATABASE_URL’] I found my connection url to be:

postgres://zugzagcaht:h-HebaxOz1_H-5uq_Olv@ec2-25-25-209-55.compute-1.amazonaws.com/zugzagcaht

(I modified the characters so this is not the real string!)

Now I am running a Python script that should connect to the database, but am finding a timeout in the connection:

import psycopg2

DB_NAME = 'zugzagcaht'
DB_USER = 'zugzagcaht'
DB_HOST = 'ec2-25-25-209-55.compute-1.amazonaws.com'
DB_PASSWORD = 'h-HebaxOz1_H-5uq_Olv'
TIMEOUT = 5 # seconds

conn = None
try:
  conn = psycopg2.connect("connect_timeout=%i dbname='%s' user='%s' host='%s' password='%s'" % (TIMEOUT, DB_NAME, DB_USER, DB_HOST, DB_PASSWORD))
except:
  print "I am unable to connect to the database"

if conn:
  cur = conn.cursor()
  cur.execute("SELECT datname from pg_database")
  rows = cur.fetchall()
  print "Here's the databases:\n"
  for row in rows:
      print "   ", row[0]

Any idea why this isn’t working?

  • 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-05T02:55:47+00:00Added an answer on June 5, 2026 at 2:55 am

    You can’t connect to Heroku shared database instances however they recently launched a new development instance which permits ingress – read more at https://postgres.heroku.com/blog/past/2012/4/26/heroku_postgres_development_plan/ – I suspect this is the problem.

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

Sidebar

Related Questions

I'm running Jenkins 1.424.2 for a Ruby on Rails app and I want to
I'm running a ruby on rails app, and I'm using jQuery to show some
I have a ruby on rails app running a server and sometimes it needs
I have a Ruby on Rails app running on my server, and I can't
I'm running Teambox (a Ruby on Rails app) and have the server running with:
I am running a Ruby 1.8.6, Rails 1.2 application on Heroku. I am using
I am running ruby 1.8.7, rails 2.3.5 and mysql database. The record in mysql
I have a ruby on rails app running on passenger / nginx. The app
I am running Spree 0-60-stable on Rails 3.0.9 on Heroku Bamboo MRI (Ruby) 1.9.2
I'm looking at ways to deploy a Ruby on Rails app (running on JRuby)

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.