Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating Mysql Schema table with values from ArrayList

807601Jun 16 2008 — edited Jun 17 2008
Hello,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2008
Added on Jun 16 2008
7 comments
721 views