Ola pessoal… uso o hadhat 9, e instalei o postgresql 7.3.4 e o j2sdk1.4.2_03.
estou tentando fazer uma conexao com o postgres, na compilacao nao dar nenhum erro,
depois de colocar o servico do postgres no ar, tento executar a classe conexao que dar o
seguinte erro:
Erro na conexao: Connection refused. Check that the hostname and port are
correct and that the postmaster is accepting TCP/IP connections.
Abaixo esta a classe conexao e a configuracao do arquivo profile, se puderem me ajudar ficaria
muito grato, mas, desde ja agradeço a atenção.
=================conexao=====================================
import java.sql.*;
public class conexao
{
public static void main(String args[])
{
try
{
Class.forName(“org.postgresql.Driver”);
System.out.println(“Driver carregado”);
}
catch(ClassNotFoundException e)
{
System.out.println(“Erro ao carregar o driver”);
}
try
{
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/teste", "postgres", "");
System.out.println("Conexao Ok");
}
catch (SQLException e)
{
System.out.println("Erro na conexao: " + e.toString());
}
}
}
==========/etc/profile==========================
JAVA_HOME="/usr/local/j2sdk1.4.2_03"
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/jre/lib/ext:$JAVA_HOME/jre/lib/ext/pg73jdbc3.jar
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CLASSPATH