Pessoal estou recebendo o seguinte erro ao tentar conexar ao banco de dados Postgress.
“The authentication type 5 is not supported.”
Alguem sabe oque provoca este erro ?
Pessoal estou recebendo o seguinte erro ao tentar conexar ao banco de dados Postgress.
“The authentication type 5 is not supported.”
Alguem sabe oque provoca este erro ?
Olá, surfzera!
Beleza?
Poste o seu código para termos idéia do que você está fazendo!
Abraços!
Classe Conexao:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class conexao {
public ResultSet res = null;
private Connection conexao;
private static final String BANCO = "jdbc:postgresql://sc7448ed101:5432/AGENDA_TELEFONICA";
private static final String USUARIO = "admin";
private static final String SENHA = "22";
public Connection conectar(){
conexao = null;
try{
Class.forName("org.postgresql.Driver");
conexao = DriverManager.getConnection(BANCO,USUARIO, SENHA);
System.out.println("Conexão estabelecida");
}catch(ClassNotFoundException ex){
System.out.println("Driver não encontrado: "+ex.getMessage());
}catch(SQLException ex){
System.out.println("Falha na conexão: "+ex.getMessage());
}
return conexao;
}
public Connection getConexao() {
return conexao;
}
public void setConexao(Connection conexao) {
this.conexao = conexao;
}
}
DAO - Pesquisa
public boolean PesquisaPorCodigo(int cgc){
Connection con = conexao.conectar();
if (con==null){
mensagem = "Erro de Conex�o";
}
unidades = new ArrayList();
String sql = "SELECT * FROM tb_unidade where uni_cgc="+cgc+"order by uni_nome";
try{
stm = con.createStatement();
res = stm.executeQuery(sql);
while(res.next()) {
unidades.add(res.getString("uni_cgc"));
unidades.add(res.getString("uni_nome"));
unidades.add(res.getString("uni_edificio"));
unidades.add(res.getString("uni_endereco"));
unidades.add(res.getString("uni_andar"));
unidades.add(res.getString("uni_email"));
unidades.add(res.getString("uni_telefone"));
unidades.add(res.getString("uni_fax"));
unidades.add(res.getString("uni_vinculado"));
}
con.close();
return true;
}
catch(SQLException e){
mensagem = e.getMessage();
return false;
}
}
Se o SGBD estiver instalado na máquina local:
private static final String BANCO = "jdbc:postgresql://localhost:5432/AGENDA_TELEFONICA";
senão:
private static final String BANCO = "jdbc:postgresql://ipdamaquina:5432/AGENDA_TELEFONICA";
então o servidor é remoto não funciono com o ip da máquiina…
também tentei com configurando o pg_hda.conf mais não tive deu certo.