Import Java.io.file;import Java.util.arraylist;import JXL. Sheet;import JXL. Workbook;import Com.jielan.util.dbutil;import Com.jielan.util.oracle;public class Test {private arraylist<string > filelist = new arraylist<string> ();p ublic static void Main (string[] args) {dbutil.startproxool (); Test t=new test (); T.getfiles ("C:\\Documents and settings\\administrator\\ Desktop \\wenzhou\\sanyue"); T.duqu ();} public void Duqu () {Bean bean=null;try {for (int j=0; j<filelist.size (); j + +) {Workbook Wbook=workbook.getworkbook (new File (Filelist.get (j))); Sheet sheet=wbook.getsheet (0); int i=0;for (i=1; i<sheet.getrows (); i++) {//First behavior header row does not import bean=new Bean ();// Excel columns correspond to Beanbean.setshoujihao (Sheet.getcell (0, I). getcontents ()); Bean.setctime (Sheet.getcell (1, i). getcontents ()); Bean.setctype (Sheet.getcell (2, I). getcontents ()); Bean.setmoney (Sheet.getcell (3, I). getcontents ()); Bean.setstatus (Sheet.getcell (4, I). getcontents ());// Insert Bean into Oracle}} ' catch (Exception e) {e.printstacktrace ()}} private void GetFiles(String FilePath) {File Dir = new File (FilePath); file[] files = dir.listfiles (); if (files = = null) return; for (int i = 0; i < files.length; i++) {if (Files[i].isdirectory ()) {GetFiles (files[i].getabs Olutepath ()); } else {Filelist.add (Files[i].getabsolutepath ()); } } }}
The code that was written to solve the problem
The above method leads to millions of data no problem