I am trying to make some code which will read text from a file and then dump it into MySQL database. It seems to be quite easy
and there are plenty of samples around to learn from and make code that does the job.
Now, the problem is that I want to see what are the different possible ways in which one could do this thing and which would be the best way.
I welcome all suggestions.
Jeanne Boyarsky wrote:Maybe you could share what you've learned about different approaches? There isn't going to be "one best way", but we could comment on tradeoffs for what you are considering.
Showing you've done this research helps people provide better answers. Otherwise you are left with:
1) Read file
2) Write JDBC
Clearly this is too high level to answer your question
Okay. I will come back with some concrete answers.
But for now, I will say that I might have to dump a lot of values 10k-25k into a DB. So, certainly this approach won't work:
1- create string 2- reassign the word being read to that string.
3- dump the string into the appropriate place in the DB.
Anayonkar Shivalkar wrote:Even going further, how about reading records in a chunk and inserting in DB? Or having two threads - one will keep on reading the records, and another would keep on inserting in DB?