• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java for batch db update..

 
Maky Chopra
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic