process large csv file with java


I have csv files with just one column and maybe 1'000'000 lines, like this:


(basically wordlists)

I would like to open these files with a swing form (netbeans) - i.e. i need an "open" button, after clicking it i select the file, and then the file gets processed line by line (i process the content of each line and query some mysql stuff for each line) until the end of the file is reached.

thanks for some input / sample code on how to do this!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use a BufferedReader. Calll readLine on it in a loop

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
netsltAuthor Commented:
Could you pls give me a bit of sample code?

CEHJ is right.  A simple search will find many examples using BufferedReader and readline .

Oracle has an excellent Java tutorial you could use:
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

CEHJ gave you the right answer within minutes.  You might not be aware that an A grade does not cost you anything, but gives more points to the expert.  Plus, of course, you got the right answer, which should be graded as an A.  Please consider that the next time you try to award points to the people who are helping on the site.
netsltAuthor Commented:
Hello CEHJ and mrcoffee356

I am really sorry if I made a rating that is not the way that it should have been done.

If I could change the rating it I would (dont see any possibility to do this - if there is, pls let me know)

My thoughts were that an answer with sample code (as I asked in the question) would have been an A, and a general answer not really an A.

But of course that was not right thinking.

Also I was not sure on the distribution of points. Both answers where of help - so I distributed the points evenly.

Maybe I should have given all points to CEHJ or at least more because he was faster? Here I was just unsure and wanted to honor both efforts.

Again: I am sorry!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.