This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version = NetBeans IDE 7.0.1 (Build 201107282000) Operating System = Windows 7 version 6.1 running on amd64 Java; VM; Vendor = 1.6.0_24 Runtime = Java HotSpot(TM) 64-Bit Server VM 19.1-b02 Hi, i`m having a problem with the debugger of netbeans. Everytime when ii use the debug mode, the resultset of a prepared statement always returns false, but when i don`t use debug mode, it works... I need some help Thanks
This is too little information Leonardo. Can you prepare a small project reproducing the problem for us? What is that statement? Can you attach a screenshot of the problem?
(In reply to comment #1) > This is too little information Leonardo. Can you prepare a small project > reproducing the problem for us? What is that statement? Can you attach a > screenshot of the problem? Of course, and thanks for answer! So, i can't take a screenshot because the code is too large... But, here is the code: public List<Encomenda> consultarEncomendasEmAberto(){ List<Encomenda> listaEncomendas = new ArrayList<Encomenda>(); ResultSet rs = null; PreparedStatement ps = null; Connection con = null; try { con = Conexao.conectarBanco(); StringBuilder sql = new StringBuilder(); sql.append(" SELECT *"); sql.append(" FROM tb_encomenda"); sql.append(" WHERE status = ?"); ps = con.prepareStatement(String.valueOf(sql)); ps.setInt(1, 1); rs = ps.executeQuery(); if(!rs.next()) { JOptionPane.showMessageDialog(null, "Não existem encomendas no momento.", "Erro", 0); } else { Encomenda encomenda = new Encomenda(); encomenda.setCliente(pesquisarCliente(rs.getString("cpf_cli"))); encomenda.setFuncionario(Conexao.buscarFuncionario(rs.getString("cpf_func"))); encomenda.setProtocolo(rs.getInt("protocolo")); encomenda.setDescricao(rs.getString("descricao")); listaEncomendas.add(encomenda); while(rs.next()) { Encomenda e = new Encomenda(); e.setCliente(pesquisarCliente(rs.getString("cpf_cli"))); e.setFuncionario(Conexao.buscarFuncionario(rs.getString("cpf_func"))); e.setProtocolo(rs.getInt("protocolo")); e.setDescricao(rs.getString("descricao")); listaEncomendas.add(e); } } } catch (Exception e) { Logger.getLogger(TelaLogin.class.getName()).log(Level.SEVERE, null, e); } finally { if(rs != null) try { rs.close(); } catch (Exception e) { } if(ps != null) try { ps.close(); } catch (Exception e) { } if(con != null) try { con.close(); } catch (Exception e) { } } return listaEncomendas; } The ResultSet always returns false, already on the first time when i call rs.next(). Ps.: (Only when i'm debugging, otherwise, when just running, the resultset works O.O") Do you understood? (Sorry my bad conversation :( ) Thanks!!
What do you mean by "the resultset of a prepared statement always returns false"? Do you mean that "rs.next()" is false under the debugger, but true during normal execution? If it is so, aren't you calling "rs.next()" in the debugger? For instance by a conditional breakpoint, or by a watch, etc.? rs.next() moves the cursor froward one row, therefore it's explicit invocation by debugger would alter the state of the application. If this is not the case, can you compare the execution under the debugger and without debugger in a more detail? E.g. test what rs.isLast() returns, etc.