现在我必须将它更新到我的数据库中,问题是我不知道如何在数据库中多次更新它。
public void generate() {
KpiMsg804 upd = createKpiMsg804();
try {
st = conn.createStatement();
System.out.println("Updating Values");
//Updating Values into DB
String query = "insert into msg_new_to_bde("
+ "tablename,action,keyinfo1,keyinfo2) values(?, ?, ?, ?)";
pstmt = conn.prepareStatement(query); // create a statement
pstmt.setString(1,upd.getTableName());
pstmt.setInt(2,upd.getAction()); // set value of staus of action
pstmt.setString(3,upd.getKeyInfo1()); // set keyinfo value1
pstmt.setString(4,upd.getKeyInfo2()); // set keyinfo value2
int rows = pstmt.executeUpdate();
System.out.println("Number of Rows Updated" +rows);
// execute insert statement
} catch (SQLException e) {
e.printStackTrace();
}