my dog learned polymorphism*
The moose likes JDBC and the fly likes write java class for batch processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "write java class for batch processing" Watch "write java class for batch processing" New topic
Author

write java class for batch processing

sanjey asok
Ranch Hand

Joined: Jul 11, 2009
Posts: 39
I want to create a java class which will read the data from database and put into a notepad file.And read the notepad file and update the database.Data to retrieved from database is huge.SO how effectively write java class??
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

You can use the java.io.BufferedReader and java.io.PrintWriter classes to read/write data to/from a text file.


SCJP 6 || SCWCD 5
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

sanjey asok wrote:Data to retrieved from database is huge.SO how effectively write java class??

Well, I believe that you can use Hibernate or some ORM framework. This problem of huges databases... I guess that every developer has. We try to optimize it, but it's sometimes difficult. I suggest that you try to use Hibernate and see the performance. If that doesn't seems ok, you can try to write your connections and SQL.

About the text file to the database, maybe if you read the file once and store that into the database while reading it's ok. If it's not, you can create some objects (like Entities or POJOs) and store those in the database.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38441
    
  23
You may find Scanner and Formatter easier for reading or writing text files.

And welcome to JavaRanch

I think this thread would sit better in the JDBC forum: moving.
 
jQuery in Action, 2nd edition
 
subject: write java class for batch processing