Pessoal, criei um método para buscar dados do banco(postgre), não estou entendendo o que está acontecendo. Pelo erro, o problema é no resultset.
O código vai aí em baixo:
public ResultSet pesquisar(){
String sql=“select tipo_habilitacao from tbl_habilitacao where " +
“cod_habilitacao = '” + getTf_cod_hab().getText()+”’";
try{
Postgres oPostgres = new Postgres(“postgres”, “654321”);
oRs = oPostgres.getResultado(sql);
oRs.next();
getTa_tipo_hab().setText(oRs.getString(2));
}catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erro: " + e.getMessage());
JOptionPane.showMessageDialog(null, sql);
}
return oRs;
}
A tabela no Bd é a seguinte:
CREATE TABLE tbl_habilitacao
(
cod_habilitacao integer NOT NULL,
tipo_habilitacao character varying(40),
CONSTRAINT tbl_habilitacao_pkey PRIMARY KEY (cod_habilitacao)
)
Obrigado, MUITO OBRIGADO!!