aspose file tools*
The moose likes JDBC and the fly likes Java for batch db update.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java for batch db update.." Watch "Java for batch db update.." New topic
Author

Java for batch db update..

Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
Hi Folks,
I need to do a batch update of db field (thanks for help with the SQL statement for this)..
I have a

and for the main() program, I have

Now, when i cann UpdateExpDate() for every record in the i/p file, it needs to make a connection.. I know this can be very expensive in terms of resources.. One way is that I can setup a connection pool class and use connections from that. Other than that, what can I do to batch process this i/p file ?
Thanks in advance for any help you can provide..
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

have a connection as a class variable.

one connection/prepared statement per object created.
Jamie

[This message has been edited by Jamie Robertson (edited September 13, 2001).]
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
Thanks Jamie !! Just moving the conn to my constructor cut down the time to load 100000 records (in a P-III 800Mhx NT machine with mySQL db) from 3 minutes to 43seconds
Will try the batching tomorrow and see if there's any dramatic improvement ... Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java for batch db update..
 
Similar Threads
auto commit within JTS transaction
JPA-Hibernate One-to-One Bidirectional Relationship issue
mask cc number in log files from a string in the log file
Problem with creating db - what's wrong?
Process the multiple records in a file by Producer/consumer concept using Multithreading