1

While trying to connect to my ElephantSQL database on Bluemix using pgadmin, it throws the following error.

Access to database denied
The server doesn't grant access to the database: the server reports 
FATAL: no pg_hba.conf entry for host "XX.XXX.XX.XX", user "abcd", database "postgres", SSL on FATAL: no pg_hba.conf entry for host "XX.XXX.XX.XX", user "abcd", database "postgres", SSL off

To access a database on a PostgreSQL server, you first have to grant primary access to the server for your client (Host Based Authentication). PostgreSQL will check the pg_hba.conf file if a pattern that matches your client address / username / database is present and enabled before any SQL GRANT access control lists are evaluated.

How can I access the pg_hba.conf file on bluemix?

enter image description here

3
  • x-posted to stackoverflow.com/q/31629438/398670 Commented Jul 26, 2015 at 1:24
  • BTW, it's pgAdmin III (or just pgAdmin), not pgAdmin 111. I fixed that. And the error message in the title does not match the one in the body ... Commented Jul 26, 2015 at 2:06
  • Yes, its pgAdmin III .
    – Betafish
    Commented Jul 26, 2015 at 18:00

2 Answers 2

3

On ElephantSQL shared plans, make sure that you put your database name (which is the same as your username) in the "Maintenance database" field in PGAdmin. This is explained in the docs. Right now you're trying to connect to the "postgres" database, which you don't have access to on the shared server.

2
  • Genius! Thanks for the light!
    – Jeff Tian
    Commented Dec 2, 2020 at 5:50
  • This fixed my issue, thank you so much. Commented Dec 6, 2020 at 18:38
2

The error message means you are already accessing pg_hba.conf. There is just no line granting access for your connection attempt. At least one of your provided details (host, user, database) does not match for any line in the file.

I am not familiar with ElephantSQL, but it seems to be a database hosting service providing standard PostgreSQL. Advice in the manual should apply. Here is a related answer with more explanation and links:

3
  • Yes, ur right. I see tht its actually seeing the .conffile. But, I cannot see how i could edit it. I mean, bluemix's ElephantSQL console does not give u a portal to edit these files. Is there a way to access these file ?. (I have added a screenshot of the portal- To the main Quesn)
    – Betafish
    Commented Jul 26, 2015 at 18:17
  • @Betafish: According to the online documentation of ElephantSQL, there should be a connection URL visible ... You might contact the company for assistance. Commented Jul 26, 2015 at 23:00
  • 1
    It works now. I did contact the company for assistance.
    – Betafish
    Commented Jul 27, 2015 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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