Connecting to AmazonAWS fails

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Connecting to AmazonAWS fails

Post by upscene » Tue 02 May 2017 08:41

Hi,

Recently, I connected to a PostgreSQL webhosting service to which I didn't have full access, I was using no specific database or 'postgres', but this failed with a 'no access' error. By entering a database name, it succeeded.

Now I want to connect to AmazonAWS, but it fails with a similar message:
no pg_hba.conf entry for host "xx", user "xx", database "x(removed)x", SSL off.
I have entered host, database, user and password, the connection fails.

However, when I use the PostgreSQL Maestro tool using the same credentials, it works!

Do you have any idea how and why?

With regards,

Martijn Tonies

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Re: Connecting to AmazonAWS fails

Post by upscene » Wed 03 May 2017 15:36

Update: when SSL setting is 'allow' or 'preferred', the connection works. No need to fill in anything else wrt SSL.


With regards.

Martijn Tonies

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Connecting to AmazonAWS fails

Post by azyk » Thu 04 May 2017 10:53

The specified error message is generated not by PgDAC, but by PostgreSQL server. It may occur due to different authentication settings located in the pg_hba.conf file. To solve the problem configure authentication in this file. You can read more details about this in PostgreSQL documentation:
https://www.postgresql.org/docs/current ... -conf.html

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Re: Connecting to AmazonAWS fails

Post by upscene » Thu 04 May 2017 10:58

azyk wrote:The specified error message is generated not by PgDAC, but by PostgreSQL server.
I know.
azyk wrote:It may occur due to different authentication settings located in the pg_hba.conf file. To solve the problem configure authentication in this file. You can read more details about this in PostgreSQL documentation:
https://www.postgresql.org/docs/current ... -conf.html
You do understand that AmazonAWS isn't exactly a service where you can edit that file, right?

That being said, it was solved using a different SSL setting, see my 2nd message.


With regards,

Martijn Tonies

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Connecting to AmazonAWS fails

Post by azyk » Fri 05 May 2017 11:27

The TPgConnection.SSLOptions.Mode property is set to smDisable by default, therefore PgDAC will create non-SSL connection. Probably, only SSL connection is allowed in the pg_hba.conf file for a user with such credentials. So you get the specified error when using smDisable and do not get when using smAllow or smPrefer. Learn more about TPgConnection.SSLOptions.Mode in our online documentation: https://www.devart.com/pgdac/docs/?deva ... slmode.htm

Post Reply