This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

write java class for batch processing

 
sanjey asok
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the java.io.BufferedReader and java.io.PrintWriter classes to read/write data to/from a text file.
 
Andre Brito
Ranch Hand
Posts: 95
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic