Show JProgressBar while connecting to database

0

I have a desktop application in java with netbeans doing the connection through JDBC, and I'm with a class that connects to the database and returns me some items that are stored there. I would like to display progressBar while the database connection is established, does anyone have any examples of how I can do this? This is the method I run 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 would like when I called this method the progress bar would appear.

    
asked by anonymous 20.09.2016 / 14:43

0 answers