A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
uploading csv file into mysql database using jsp
Joined: Oct 04, 2007
Nov 23, 2009 04:28:52
I need to upload a csv file into mysql database using jsp.Is it possible to do?
Joined: Oct 27, 2005
Nov 23, 2009 04:49:45
Sure it is, but you need to split the problem into several smaller problems:
1) Upload the file. You can use
Apache Commons FileUpload
2) Reading and parsing the CSV file so you have better access to its columns. Check out
Accessing File Formats
. I myself have good experiences with opencsv.
3) Insert the data from the CSV file into your table. You will need
or an abstraction layer for that.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
manoj r patil
Joined: Jun 06, 2002
Nov 23, 2009 04:49:54
CSV file is nothing but a plain text file with comma separated values. There are quite a few csv parsers available on the net.
When you say "you want to upload csv file into mysql", do you want to suck the complete csv file as is and dump it into MySQL? You can use multipart request for that and can dump in the "text" column.
If you want to extract values out of that file, you can upload the file using multipart form data and then using csv parser at the server side, you can extract the values and save to database.
love your job and not your company;
...because you never know when your company will stop loving you!
rocket mass heater
subject: uploading csv file into mysql database using jsp
how to load a cvs file into a oracle 9i database using java
Can POI read CSV files
Can you use JPA to import a csv file?
how to import records from CSV file into MYSQL database table?
Puzzle in mocking the database
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014