Guest User

Untitled

a guest
Aug 27th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. connection timeout when connecting to a remote postgresql database
  2. int i = 0;
  3. while(true){
  4.  
  5. IConnection conn = ((ConnectionHelper)HelperFactory.getInstance().getHelper("ConnectionHelper")).getConnection("psql");
  6.  
  7. if(conn != null && conn.connect()){
  8. conn.close();
  9. System.out.println(i++);
  10. }
  11. }
  12.  
  13. DriverManager.getConnection("jdbc:postgresql://" + host + ":5432/" + database,
  14. user, password);
  15.  
  16. org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
  17. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)
  18. at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
  19. at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
  20. at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
  21. at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
  22. at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30)
  23. at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
  24. at org.postgresql.Driver.makeConnection(Driver.java:393)
  25. at org.postgresql.Driver.connect(Driver.java:267)
Add Comment
Please, Sign In to add comment