• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Java for batch db update..

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
and POOF! You're gone! But look, this tiny ad is still here:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic