Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PostgreSQLJDBC {
- public static void main(String args[]) {
- System.out.println("looking for db connection");
- Connection c = null;
- try {
- Class.forName("org.postgresql.Driver");
- c = DriverManager //139.59.175.170 eller 127.0.0.1/32
- .getConnection("jdbc:postgresql://178.62.33.183:5432/steinar");
- } catch (SQLException e) {
- System.out.print("sql exception thrown ");
- e.printStackTrace();
- System.err.println(e.getClass().getName()+": "+e.getMessage());
- System.exit(0);
- }
- catch (ClassNotFoundException e){
- e.printStackTrace();
- }
- System.out.println("Opened database successfully");
- }
- }
- FATAL: no pg_hba.conf entry for host "ip", user "user", database "db",
- Connection to 178.62.33.183:5432 refused.
- Check that the hostname and port are
- correct and that the postmaster is
- accepting TCP/IP connections.
- # IPv4 local connections:
- host all myUserName myIp trust
- psql: could not connect to server: No such file or directory
- Is the server running locally and accepting
- connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Add Comment
Please, Sign In to add comment