Oi pessoal,
Quando chamo um metodo pela segunda vez para, atualizar um jcombobox, o createStatement esta gerando o seguinte erro:java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.throwGenericSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(Unknown Source) at interfaces.GuiGestora.ListarCodGestora(GuiGestora.java:293) at interfaces.GuiGestora$2.actionPerformed(GuiGestora.java:165) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)Alguém tem alguma idéia do que esta acontecento!!!Veja o metodo:
public void ListarCodGestora() {
conexao();
String h = "";
//bloco try responsavel por recuperar os dados da funcao
try {
dados.removeAllElements();
teste.addElement(h);
String sql = "Select cod_ug from gestora";
Stmt = con.createStatement();//linha 293
RS =
Stmt.executeQuery(sql);
RS.next();
do {
teste.addElement(RS.getString("cod_ug"));
} while (RS.next());
dados = new DefaultComboBoxModel(teste);
} catch (SQLException ex) {
ex.printStackTrace();
// JOptionPane.showMessageDialog(
// null,
// "Não existe Unidade Gestora Cadastrada!",
// "Mensagem",
// JOptionPane.ERROR_MESSAGE);
}
fechar();
gestora= new javax.swing.JComboBox(dados);
getContentPane().add(gestora);
gestora.setBounds(110, 26, 240, 20);
//validate();
gestora.repaint();
}