Answer the question
In order to leave comments, you need to log in
How to connect to postgresql in java?
through pgAdmin it was possible to connect, and when trying to connect in java, an exception flies.
Class.forName("org.postgresql.Driver");
connection = DriverManager.getConnection(
"jdbc:postgresql://109.104.172.25:5432/postgres?user=pgsql&password=pwd");
Answer the question
In order to leave comments, you need to log in
the snag was in ssl.
fixed like this
String url = "jdbc:postgresql://HOST:5432/TABLE?"+
"ssl=true&"+
"sslfactory=org.postgresql.ssl.NonValidatingFactory";
String user = "pgsql";
String password = "PWD";
Class dbDriver = Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection(url, user, password);
Learn Google. Here is the answer in Russian: no pg_hba.conf entry for host
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question