Web Development

General discussion


Upload excel file, store data in oracle

By seema.m.tulsiani ·

I want to allow the user to upload a excel file through a jsp webpage and then after verifying the data, insert it into a oracle database table.
I am programming in java,javascript.. would really appreciate if I could get some help/hint in writing this code.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by sushilsri In reply to Upload excel file, store ...

I have done the same thing on my application and you could do the same as well
1. On the JSP use multipart form to load the excel file and you would need a MultiPartParser available from for instance Oreilly.This will allow the loading of the file.
2. The loaded file can be processed via Jakarta POI which allows you to parse Excel file and this will allow you to access the values on the Excel Spreadsheet .You can store them in Java Collection ,
3. Use JDBC to pass the Collection values into Database tables.

Alternatively you could in theory store the whole Excel file as a database object which can be retrieved later.I dont think thats what you want to do anyway.

Collapse -

Plz help

by umeshsin In reply to

Can you please help me sending the code that implemented the process of uploading excel file and saving it to a database? It would be a great help to me? I need it very urgently... :) We are having a such requirement where we need to do this and insertion of data is required on Oracle... thanks in advance! Cheers

Collapse -

by slog In reply to Upload excel file, store ...

One thing to keep in mind is that reading an Excel file via the Jakarta POI requires a great deal of coding. They have a standard object to open an entire Excel file but the object has a very large footprint in memory. If you just want to open the file and retrieve only the parts you need then it requires more coding and a thorough knowledge of the internal structure of an Excel file. Also, Microsoft is going to switch Excel over to an XML format soon - if not already - and then your Jakarta code is throw away. If you have the option of requiring your users to save the data in a TAB delimited format you can parse the data much easier.

Collapse -

by Gary_W In reply to Upload excel file, store ...

Another alternative may be to accept the file and load it into a temp or staging table as is. That staging table can then be processed via an insert trigger or a stored procedure to validate and then move data into the real tables. I guess it depends on where you want the validating to happen and where your coding experience is.


Related Discussions

Related Forums