Hey guys,
Please tell me how to load data from an excel file to a mysql database using jsp.

Recommended Answers

All 9 Replies

You need to find a way to read the excel file. Once you do that, then it is easy. Call methods that save values to the database and pass as arguments the values read from the excel.

You will need 2 different things. Write methods that write to the database.
Find a way to read the contents of an excel file.

What exactly is your problem?

i have this excel sheet names "marks.xls". The xls file consists of marks of students. I want to add these marks to the mysql database.
I read somewhere that it is better to convert the xls file to cvs format and then insert it into the database from the cvs but i m not getting any success. Please suggest.

Where are you having problems:
- Convert excel to csv
- Read values
- Save to DB

Those are different unrelated issues. You can do one without having done the other.

Another option would be to read excel with Apache POI and save values in db

that would be best. Even better would be to not use a JSP at all for it.

that would be best. Even better would be to not use a JSP at all for it.

Well if you need to upload file where only registered users are allow to do so you will need JSP or JSF...

Well if you need to upload file where only registered users are allow to do so you will need JSP or JSF...

Nope. Use an html page to allow entering credentials and upload information for the file, which is submitted to a servlet.
You could conceivably use a JSP to display the results of the operation (maybe a tabular view of the data inserted) but that's not part of the "upload data" requirement.

Hey Peter..
I downloaded the POI package and directly uploaded the file to the db...Thnx...

After uploading a excel file from jsp then send to servlet now how to get details from excel file in servlet .........from any drve likec://my.xls is working fine but i dont want to save just get the data and update db thats it...but i am not able to do that plz show the code ho to make a xl file in servlet from input stream ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.