Plsql Import a folder under all Excel

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.