How to Import Data from Excel sheet to DB Table through Oracle ADF ? using Input file ?!
-
af:inputeFile will upload the file. You'll need another package to actually parse it, if that's your objective.Patrick J Abare II– Patrick J Abare II2014-07-14 13:34:36 +00:00Commented Jul 14, 2014 at 13:34
-
yes .. how to parse excel sheet data to DB ?A_BOSS– A_BOSS2014-07-14 13:37:37 +00:00Commented Jul 14, 2014 at 13:37
-
Posted as an answer, really not enough info in the question to give you anything more regarding the actual persistence to the DB. Just use JDBC?Patrick J Abare II– Patrick J Abare II2014-07-14 14:01:10 +00:00Commented Jul 14, 2014 at 14:01
Add a comment
|
4 Answers
To upload the file use standard implementation of:
<af:inputFile/>
For parsing the Excel file, there is no inherent java support, but I've used Apache POI in the past.
http://howtodoinjava.com/2013/06/19/readingwriting-excel-files-in-java-poi-tutorial/
Comments
Thanks for answers ,
I solved the issue by using Apache POI to parse excel sheet to java objects
Steps :
- use
<af:inputFile/>component in jsf or jspx page. - in managed bean get the file inputstream from inputFile component.
- parse this excel file using Apache POI.
- inserted them to DB using AM in adf.
1 Comment
Darko
Thank you, this has helped me alot. Might I add some details for future users since I've spent a few days to do this. 1) download both poi and ooxml libraries and add them through tools - manage libraries, and project properties - libraries and classpath 1.5) Connect valuechanged from afinputfile to backing bean method 2) import libraries in your managed bean and parse to input stream 3) parse to hssf (or the other one) in a try catch block. 4) I'm still working on the forth step If anyone needs code example, I'll post it.