I get following error when I try to connect using DBI
DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) failed: FATAL: no pg_hba.conf entry for host "192.168.0.1", user "postgres", database "chaosLRdb", SSL off
Here is my pg_hba.conf file:
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
host all postgres 127.0.0.1/32 trust
host all postgres 192.168.0.1/32 trust
host all all 192.168.0.1/32 trust
host all all 192.168.0.1/128 trust
host all all 192.168.0.1/32 md5
host chaosLRdb postgres 192.168.0.1/32 md5
local all all 192.168.0.1/32 trust
My perl code is
#!/usr/bin/perl-w
use DBI;
use FileHandle;
print "Start connecting to the DB...\n";
@ary = DBI->available_drivers(true);
%drivers = DBI->installed_drivers();
my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433", "postgres", "chaos123");
May I know what i miss here?
For those who are getting this error in DBeaver the solution was found here at line:
@lcustodio on the SSL page, set SSL mode: require and either leave the SSL Factory blank or use the org.postgresql.ssl.NonValidatingFactory
Under Network -> SSL tab I checked the Use SLL checkbox and set Advance -> SSL Mode = require and it now works.
In your pg_hba.conf file, I see some incorrect and confusing lines:
I suspect that if you md5'd the password, this might work if you trim the lines. To get the md5 you can use perl or the following shell script:
So then your connect line would like something like:
For more information, here's the documentation of postgres 8.X's pg_hba.conf file.
Your postgres server configuration seems correct
That should grant access from the client to the postgres server. So that leads me to believe the username / password is whats failing.
Test this by creating a specific user for that database
Then adjust your perl script to use the newly created user
BTW, in my case it was that I needed to specify the user/pwd in the url, not as independent properties, they were ignored and my OS user was used to connect
My config is in a WebSphere 8.5.5 server.xml file
This would not work and was getting the error:
To resolved this problem, you can try this.
first you have find out your pg_hba.conf and write :
after that restart pg server:
or
If you are getting an error like the one below:
then add an entry like the following, with your mac address.