Updating Mysql Schema table with values from ArrayList
807601Jun 16 2008 — edited Jun 17 2008Hello,
I have a schema called Times with the following tables "machine_ID, numTime, timeDiff. In my java code, I have an ArrayList called machine_Time containing integer values which I want to insert into timeDiff. timeDiff has currently only '0' values. The part of my code is as follows:
{code}
PreparedStatement ps;
ps = con.prepareStatement("UPDATE Times SET timeDiff = ? WHERE machine_ID = 3000");
//the values to insert
for (int m = 0; m < machine_Time.size(); m++){
int temp = ((Integer)(machine_Time.get(m))).intValue();
ps.setInt(1, temp);
ps.executeUpdate();
}
{code}
If I run the code it will execute but the table will not be updated. Please can someone give me the best approach to solve the problem.
Thanks,
Jona_T