i am using redhat 9 with postgres 7.3...when i run the program below it gives the following error :
SQL EXCEPTION Connection refused. Check that the hostname and port are correct
and that the postmaster is accepting TCP/IP connections.
------------------
program :
import java.sql.*;
class mydb
{
public static void main(
String [] args)
{
Connection dbconn ;
Statement stmt ;
ResultSet author ;
String sourceURL = "jdbc
ostgresql://localhost/synergy";
try
{
Class.forName("org.postgresql.Driver");
dbconn = DriverManager.getConnection(sourceURL,"monte","powers");
stmt = dbconn.createStatement();
author = stmt.executeQuery("SELECT * FROM cust_info");
while(author.next())
{
System.out.println(author.getString("cust_id"));
}
dbconn.setAutoCommit(true);
stmt.close() ;
}
catch(ClassNotFoundException cnfe){
System.out.println("CLASS NOT FOUND EXCEPTION "+cnfe);
}
catch(SQLException sqle){
System.out.println("SQL EXCEPTION "+sqle);
}
}
}
---------------------------------------------
i have also made changes in pg_hba.conf
host all all 127.0.0.1 255.255.255.255 trust
and postgres.conf (whatever the exact name) where i made
tcpip_socket = true
-------------plz have a look