File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes batch updating mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "batch updating mysql" Watch "batch updating mysql" New topic
Author

batch updating mysql

mat buckland
Greenhorn

Joined: Sep 01, 2009
Posts: 24
I have a Container of objects in my server, which regularly need writing to the database. At the moment I simply iterate through the container and do an executeUpdate() for each object.

This is slow though. Is there a way I can create an update that will send all the objects to the database in one cumulative update instead of many?

thanks
mat buckland
Greenhorn

Joined: Sep 01, 2009
Posts: 24
tis ok, i've found the answer!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
Well done

For the benefit of future generations searching this forum, how did you do it?
mat buckland
Greenhorn

Joined: Sep 01, 2009
Posts: 24
good point!

Like this:

http://www.java2s.com/Code/Java/Database-SQL-JDBC/BatchupdateforMySQL.htm
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
It's nice when you can find links like that, isn't it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: batch updating mysql