View Single Post

   
  #1 (permalink)  
Old 04-16-2008, 12:39 AM
Pedro Mendes
 
Posts: n/a
Default Problem getting a connection with Postgres 8.0.3

Hello,



I'm having some problems connecting my jsp application using driver
postgresql-8.0-312.jdbc3 to a local postgresql database server. The
connection seems to be always refused whatever the user and/or database.

This is the code I wrote:





try

{

Class.forName("org.postgresql.Driver");

Connection db =
DriverManager.getConnection("jdbcostgresql://192.168.8.2/cgm","cgm","esper
anca");



for( SQLWarning warn = db.getWarnings(); warn != null; warn =
warn.getNextWarning() )

{

System.out.println( "SQL
Warning:" ) ;

System.out.println( "State
: " + warn.getSQLState() ) ;

System.out.println(
"Message: " + warn.getMessage() ) ;

System.out.println( "Error
: " + warn.getErrorCode() ) ;

}

...



This is the error returned:



Message: Connection refused. Check that the hostname and port are correct
and that the postmaster is accepting TCP/IP connections.

Error : 0



Hopping for an answer

Pedro Mendes - Portugal






Reply With Quote