我想知道如何在插入新行而不重新打开整个应用程序后刷新数据库。我希望能够在我的应用程序的后续步骤中看到新数据。我找不到任何解决方案,所以如果您发布示例,我会很高兴。当然如果可能的话。这是我的连接方法
    try{
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    Class.forName(driver);
    String db = "jdbc:odbc:FlowValves";
    con = DriverManager.getConnection(db);
    st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    }catch(Exception ex){
        ex.printStackTrace();
    }
这是我的一种插入方法。
    String sql = "select * from Typy";
    try{
        ResultSet result;
        result = st.executeQuery(sql);
        result.moveToInsertRow();
        String stringNazwa = (String)nazwaZaworuField.getText();
        result.updateString("Typ", stringNazwa);
        String stringDN = (String)dnZaworuField.getText();
        result.updateString("DN", stringDN);
        String stringPN = (String)pnZaworuField.getText();
        result.updateString("PN", stringPN);
        String stringIndeks = (String)indeksField.getText();
        result.updateString("Indeks", stringIndeks);
        result.insertRow();
        result.close();
        JOptionPane.showMessageDialog(null, "Wprowadzono dane", "Komunikat", JOptionPane.INFORMATION_MESSAGE);
    }catch(Exception ex){
        ex.printStackTrace();
    }