Show Jprogressbar while connecting to database

Asked

Viewed 298 times

0

I have a java desktop application with netbeans connecting via JDBC, and I have a class that connects to a database and returns some items that are stored there. I’d like to exhibit a progressBar As the bank connection is established, does anyone have any examples of how I can do this? This is the method that executes and freezes the screen:

public ResultSet informacoesDiarias(String dataInicial,String dataFinal) {
    conn = new ConexaoBD().getConexao();

    String sql = "SELECT * from producaoDiara WHERE dataProducao BETWEEN '" + dataInicial +" 'AND' " +dataFinal+ "'";
    try {

        st = conn.createStatement();
        rs = st.executeQuery(sql);

    } catch (SQLException ex) {
        System.err.println("Erro do capiroto:"+ex.getMessage()+"\ntipo:"+ex.getClass());
    }
    return rs;
}

I wish that when I called this method the progress bar would appear.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.