OSDN Git Service

20170128
authorkuboryu <kuboryu@yahoo.co.jp>
Fri, 27 Jan 2017 23:54:40 +0000 (08:54 +0900)
committerkuboryu <kuboryu@yahoo.co.jp>
Fri, 27 Jan 2017 23:54:40 +0000 (08:54 +0900)
com/rapide_act/CmnProperty.java
com/rapide_act/CmnUtils.java
com/rapide_act/DataAccessObjects.java
com/rapide_act/RapideLoader.java
com/rapide_act/RapideUnloader.java

index ff513cb..f5a94d4 100644 (file)
@@ -73,7 +73,8 @@ public class CmnProperty{
        protected String [] prop_val = new String[KEYS];
        protected static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"};
        protected static final String DEFAULT_IN_FOLDER = "input";
-       protected static final String DEFAULT_PROP_FILE = "RapideLoader.properties";
+       protected static final String DEFAULT_OUT_FOLDER = "output";
+       protected static final String DEFAULT_PROP_FILE = "RapideAct.properties";
        protected static String [] tSqlArray = {
                "select "
                + " table_name "
@@ -162,7 +163,7 @@ public class CmnProperty{
                Properties prop = null;
                try {
                        prop = new Properties();
-                       br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(_propFile), "UTF-8"));
+                       br = new BufferedReader(new InputStreamReader(CmnProperty.class.getClassLoader().getResourceAsStream(_propFile), "UTF-8"));
                        prop.load(br);
                        for(int i=0;i<KEYS;i++){
                                prop_val[i] = prop.getProperty(database + "." +PROP_KEY[i]);
@@ -170,7 +171,7 @@ public class CmnProperty{
                        br.close();
                        br = null;
                } catch (NullPointerException e) {
-                               throw new Exception("Property File (" + _propFile +") Not Found");
+                               throw new Exception("\83v\83\8d\83p\83e\83B\83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81B[" + _propFile +"]");
                } catch (IOException e) {
                                throw e;
                }
@@ -222,7 +223,7 @@ public class CmnProperty{
                if(!CmnUtils.isEmpty(prop_val[D_TBLKEYSQL]))tkSql = prop_val[D_TBLKEYSQL];
                if(!CmnUtils.isEmpty(prop_val[D_ORDER]) && prop_val[D_ORDER].toUpperCase().equals("Y"))isOrder = true;
                if(!CmnUtils.isEmpty(prop_val[D_QUOTATION]) && prop_val[D_QUOTATION].toUpperCase().equals("N"))isQuotation = false;
-               if(!CmnUtils.isEmpty(prop_val[D_BATCOUNT]))batchCount = Integer.parseInt(prop_val[D_BATCOUNT]);
+               if(!CmnUtils.isEmpty(prop_val[D_BATCOUNT]) && CmnUtils.isNumeric(prop_val[D_BATCOUNT]))batchCount = Integer.parseInt(prop_val[D_BATCOUNT]);
                if(!CmnUtils.isEmpty(prop_val[D_INCLTAB]))isInclTables = true;
                if(!CmnUtils.isEmpty(prop_val[D_EXCLTAB]))isExclTables = true;
                if(!CmnUtils.isEmpty(prop_val[D_INCLCOL]))isInclCols = true;
@@ -246,14 +247,14 @@ public class CmnProperty{
                if(!CmnUtils.isEmpty(prop_val[D_DBYTEMASKCHR]))doubleByteMaskChar = prop_val[D_DBYTEMASKCHR].charAt(0);
                if(!CmnUtils.isEmpty(prop_val[D_MASKPTN]))maskPattern = prop_val[D_MASKPTN];
 
-               if(user == null){
-                       throw new Exception("user is null");
-               } else if (pass == null){
-                       throw new Exception("pass is null");
-               } else if (url == null){
-                       throw new Exception("url is null");
-               } else if (driver == null){
-                       throw new Exception("driver is null");
+               if(CmnUtils.isEmpty(user)){
+                       throw new Exception("us(\83\86\81[\83UID)\82ª\96¢\8ew\92è\82Å\82·\81B");
+               } else if (CmnUtils.isEmpty(pass)){
+                       throw new Exception("pw(\83p\83X\83\8f\81[\83h)\82ª\96¢\8ew\92è\82Å\82·\81B");
+               } else if (CmnUtils.isEmpty(url)){
+                       throw new Exception("url(\90Ú\91±\8fî\95ñ)\82ª\96¢\8ew\92è\82Å\82·\81B");
+               } else if (CmnUtils.isEmpty(driver)){
+                       throw new Exception("dr(\83h\83\89\83C\83o)\82ª\96¢\8ew\92è\82Å\82·\81B");
                }
                
                for(int i = 0;i<DB_TYPE_NAME.length;i++){
@@ -266,21 +267,13 @@ public class CmnProperty{
                if (dbType != DB_TYPE_UNKNOWN){
                        if(!CmnUtils.isEmpty(prop_val[D_TBLSQL])){
                                tSql = prop_val[D_TBLSQL];
-                       } else {
-                               tSql = tSqlArray[dbType];
-                       }
-               } else {
-                       throw new Exception("dbtype unknown");
-               }
-
-               if (dbType != DB_TYPE_UNKNOWN){
-                       if(!CmnUtils.isEmpty(prop_val[D_TBLKEYSQL])){
                                tkSql = prop_val[D_TBLKEYSQL];
                        } else {
+                               tSql = tSqlArray[dbType];
                                tkSql = tkSqlArray[dbType];
                        }
                } else {
-                       throw new Exception("dbtype unknown");
+                       throw new Exception("\83f\81[\83^\83x\81[\83X\90»\95i\82ª\8e¯\95Ê\82Å\82«\82Ü\82¹\82ñ\81B[" + url + "]");
                }
 
                if(database!=null)CmnUtils.infoPrint("-->\91Î\8fÛ\83f\81[\83^\83x\81[\83X='" + database.toUpperCase() + "'");
index 70ba137..afe97a8 100644 (file)
@@ -431,6 +431,16 @@ public class CmnUtils{
                }
        }
 
+       public static boolean isNumeric(String _str) {
+               boolean retVal = true;
+               try {
+                       int val = Integer.parseInt(_str);
+               } catch (Exception e){
+                       retVal = false;
+               }
+               return retVal;
+       }
+
        public static String[] getSystemProperty(String _str) throws Exception{
                String [] retValue = null;
                if(System.getProperty(_str)!=null){
index 5897f38..5ad5d61 100644 (file)
@@ -61,57 +61,10 @@ public class DataAccessObjects{
        private byte [] colBytes = null;
        private Blob colBlob = null;
        private Clob colClob = null;
-       private int recCount = 0;
-       private InputStream is = null;
-       private ByteArrayOutputStream baos = null;
-       private boolean isQuotation = true;
-       private boolean isMask = false;
-       private boolean isInclMaskCols = false;
-       private boolean isExclMaskCols = false;
-       private String inclMaskCols = null;
-       private String exclMaskCols = null;
        private String tbName = null;
-       private String nullMark = "";
-       private String lnSprtr = System.getProperty("line.separator");
-       private String delimiter = "\t";
-       private char singleByteChr = '*';
-       private char doubleByteChr = '\81\96';
-       private String maskPtn = "ALT";
-       private static final int MASK_PTN_ALL = 0;
-       private static final int MASK_PTN_ALT = 1;
-       private static final int MASK_PTN_EDGE = 2;
-       private static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"};
-       private static final int USER = 0;
-       private static final int PASS = 1;
-       private static final int URL = 2;
-       private static final int DRIVER = 3;
-       private static final int OUTPUT = 4;
-       private static final int INPUT = 5;
-       private static final int LINESEP = 6;
-       private static final int INLINESEP = 7;
-       private static final int FILENCODE = 8;
-       private static final int NULLMARK = 9;
-       private static final int DELIMITER = 10;
-       private static final int TBLSQL = 11;
-       private static final int TBLKEYSQL = 12;
-       private static final int ORDER = 13;
-       private static final int QUOTATION = 14;
-       private static final int BATCOUNT = 15;
-       private static final int INCLTAB = 16;
-       private static final int EXCLTAB = 17;
-       private static final int INCLCOL = 18;
-       private static final int EXCLCOL = 19;
-       private static final int INCLCOLMASK = 20;
-       private static final int EXCLCOLMASK = 21;
-       private static final int SBYTEMASKCHR = 22;
-       private static final int DBYTEMASKCHR = 23;
-       private static final int MASKPTN = 24;
-       private static final int PROPFILE = 25;
-       private static final String [] PROP_KEY = { "us","pw","url","dr","out","in","ls","ils","fe","nm",
-                                                                                               "dm","ts","tks","od","qt","bc","it","et","ic","ec",
-                                                                                               "icm","ecm","smc","dmc","mp","pf"};
-       private static final int KEYS = 26;
-       private String [] prop_val = null;      
+       private int recCount = 0;
+       private CmnProperty cp = null;
+
        DataAccessObjects(String _user, String _pass, String _url, String _driver){
                user = _user;
                pass = _pass;
@@ -119,6 +72,14 @@ public class DataAccessObjects{
                driver = _driver;
        }
 
+       DataAccessObjects(CmnProperty _cp){
+               cp = _cp;
+               user = cp.user;
+               pass = cp.pass;
+               url = cp.url;
+               driver = cp.driver;
+       }
+
        public Connection connect() throws Exception{
 
                try {
@@ -298,20 +259,6 @@ public class DataAccessObjects{
                tbName = _tbName;
        }
 
-       public void setPropVal(String[] _prop_val) throws Exception{
-               prop_val = _prop_val;
-               if(!CmnUtils.isEmpty(prop_val[LINESEP]))lnSprtr = CmnUtils.getLineSeparator(prop_val[LINESEP]);
-               if(!CmnUtils.isEmpty(prop_val[NULLMARK]))nullMark = prop_val[NULLMARK];
-               if(!CmnUtils.isEmpty(prop_val[QUOTATION]) && prop_val[QUOTATION].toUpperCase().equals("N"))isQuotation = false;
-               if(!CmnUtils.isEmpty(prop_val[INCLCOLMASK]))isInclMaskCols = true;
-               if(!CmnUtils.isEmpty(prop_val[EXCLCOLMASK]))isExclMaskCols = true;
-               if(isInclMaskCols || isExclMaskCols)isMask = true;
-               if(!CmnUtils.isEmpty(prop_val[SBYTEMASKCHR]))singleByteChr = prop_val[SBYTEMASKCHR].charAt(0);
-               if(!CmnUtils.isEmpty(prop_val[DBYTEMASKCHR]))doubleByteChr = prop_val[DBYTEMASKCHR].charAt(0);
-               if(!CmnUtils.isEmpty(prop_val[MASKPTN]))maskPtn = prop_val[MASKPTN];
-               if(!CmnUtils.isEmpty(prop_val[DELIMITER]))delimiter = CmnUtils.getDelimiter(prop_val[DELIMITER]);
-       }
-
        public ResultSet getResultSet() throws Exception{
                return rst;
        }
@@ -353,31 +300,31 @@ public class DataAccessObjects{
 
                                                if (colString != null) {
                                                        if (i == _firstCol){
-                                                               if(isQuotation){
+                                                               if(cp.isQuotation){
                                                                        if (_firstCol == _lastCol){
-                                                                               _pw.print("\"" + colString + "\"" + lnSprtr);
+                                                                               _pw.print("\"" + colString + "\"" + cp.lineSeparator);
                                                                        } else {
                                                                                _pw.print("\"" + colString);
                                                                        }
                                                                } else {
                                                                        if (_firstCol == _lastCol){
-                                                                               _pw.print(colString + lnSprtr);
+                                                                               _pw.print(colString + cp.lineSeparator);
                                                                        } else {
                                                                                _pw.print(colString);
                                                                        }
                                                                }
                                                                
                                                        } else if (i == _lastCol){
-                                                               if(isQuotation){
-                                                                       _pw.print("\"" + delimiter + "\"" + colString + "\"" + lnSprtr);
+                                                               if(cp.isQuotation){
+                                                                       _pw.print("\"" + cp.delimiter + "\"" + colString + "\"" + cp.lineSeparator);
                                                                } else {
-                                                                       _pw.print(delimiter + colString + lnSprtr);
+                                                                       _pw.print(cp.delimiter + colString + cp.lineSeparator);
                                                                }
                                                        } else {
-                                                               if(isQuotation){
-                                                                       _pw.print("\"" + delimiter + "\"" + colString);
+                                                               if(cp.isQuotation){
+                                                                       _pw.print("\"" + cp.delimiter + "\"" + colString);
                                                                } else {
-                                                                       _pw.print(delimiter + colString);
+                                                                       _pw.print(cp.delimiter + colString);
                                                                }
                                                        }
                                                        
@@ -385,30 +332,30 @@ public class DataAccessObjects{
 
                                                } else {
                                                        if (i == _firstCol){
-                                                               if(isQuotation){
+                                                               if(cp.isQuotation){
                                                                        if (_firstCol == _lastCol){
-                                                                               _pw.print("\"" + nullMark + "\"" + lnSprtr);
+                                                                               _pw.print("\"" + cp.nullMark + "\"" + cp.lineSeparator);
                                                                        } else {
-                                                                               _pw.print("\"" + nullMark);
+                                                                               _pw.print("\"" + cp.nullMark);
                                                                        }
                                                                } else {
                                                                        if (_firstCol == _lastCol){
-                                                                               _pw.print(nullMark + lnSprtr);
+                                                                               _pw.print(cp.nullMark + cp.lineSeparator);
                                                                        } else {
-                                                                               _pw.print(nullMark);
+                                                                               _pw.print(cp.nullMark);
                                                                        }
                                                                }
                                                        } else if (i == _lastCol){
-                                                               if(isQuotation){
-                                                                       _pw.print("\"" + delimiter + "\"" + nullMark + "\"" + lnSprtr);
+                                                               if(cp.isQuotation){
+                                                                       _pw.print("\"" + cp.delimiter + "\"" + cp.nullMark + "\"" + cp.lineSeparator);
                                                                } else {
-                                                                       _pw.print(delimiter + nullMark + lnSprtr);
+                                                                       _pw.print(cp.delimiter + cp.nullMark + cp.lineSeparator);
                                                                }
                                                        } else {
-                                                               if(isQuotation){
-                                                                       _pw.print("\"" + delimiter + "\"" + nullMark);
+                                                               if(cp.isQuotation){
+                                                                       _pw.print("\"" + cp.delimiter + "\"" + cp.nullMark);
                                                                } else {
-                                                                       _pw.print(delimiter + nullMark);
+                                                                       _pw.print(cp.delimiter + cp.nullMark);
                                                                }
                                                        }
                                                }
@@ -445,26 +392,26 @@ public class DataAccessObjects{
                if (CmnUtils.isColString(_colTypeName)) {
                        colString = _rst.getString(_rec_cnt);
                        if (colString != null) {
-                               if(isQuotation){
+                               if(cp.isQuotation){
                                        colString =colString.trim().replaceAll("\0","").replaceAll("\"","\"\"");
                                } else {
                                        colString =colString.trim().replaceAll("\0","");
                                }
-                               if(isMask){
+                               if(cp.isMask){
                                        if(_colMask==true){
                                                StringBuffer sb = new StringBuffer();
                                                for(int j=0;j<colString.length();j++){
-                                                       if((maskPtn.toUpperCase().equals(MASK_PTN[MASK_PTN_ALT]) && 
+                                                       if((cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALT]) && 
                                                                        (j % 2) == 1) || 
-                                                          (maskPtn.toUpperCase().equals(MASK_PTN[MASK_PTN_EDGE]) && 
+                                                          (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_EDGE]) && 
                                                                        !(j == 0 || j == colString.length() - 1) ||
-                                                          (maskPtn.toUpperCase().equals(MASK_PTN[MASK_PTN_ALL]))
+                                                          (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALL]))
                                                           )
                                                        ){
                                                                        if(CmnUtils.isHankaku(colString.charAt(j))){
-                                                                               sb.append(singleByteChr);
+                                                                               sb.append(cp.singleByteMaskChar);
                                                                        } else {
-                                                                               sb.append(doubleByteChr);
+                                                                               sb.append(cp.doubleByteMaskChar);
                                                                        }
                                                        } else {
                                                                sb.append(colString.charAt(j));
index cfa5480..ef9b889 100644 (file)
@@ -50,12 +50,12 @@ public class RapideLoader{
        }
 
 
-       RapideLoader(String _database) throws Exception{
+       RapideLoader(String _database) {
                super();
                database = _database;
        }
 
-       private void load() throws Exception{
+       private void load(){
                Connection conn                                 = null;
                PreparedStatement stmt                  = null;
                PreparedStatement stmt_ins              = null;
@@ -85,14 +85,12 @@ public class RapideLoader{
                int fl_col_count                                = 0;
                boolean isLob                                   = false;
                boolean isContinue                              = false;
+               CmnProperty cp = null;
+               DataAccessObjects dao = null;
 
-               CmnProperty cp = new CmnProperty();
-               cp.setProperty(database);
-               
-               DataAccessObjects dao = new DataAccessObjects(cp.user, cp.pass, cp.url, cp.driver);
                try {
-                       conn = dao.connect();
-                       conn.setAutoCommit(false);
+                       cp = new CmnProperty();
+                       cp.setProperty(database);
 
                        if(cp.inFolder != null){
                                folder = new File(cp.inFolder);
@@ -103,9 +101,11 @@ public class RapideLoader{
                                        folder = new File(cp.DEFAULT_IN_FOLDER + "/" + cp.DB_TYPE_NAME[cp.dbType].toUpperCase());
                                }
                        }
-                       CmnUtils.infoPrint("-->\93ü\97Í\8c³='" + folder + "'");
+                       CmnUtils.infoPrint("-->\93ü\97Í\8c³\83t\83H\83\8b\83_='" + folder + "'");
                        CmnUtils.infoPrint("\83f\81[\83^\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82µ\82½\81B");
-
+                       dao = new DataAccessObjects(cp);
+                       conn = dao.connect();
+                       conn.setAutoCommit(false);
                        dao.select(cp.tSql);
                        alData = dao.getArrayList();
                        tb_count = dao.getColumnCount();
@@ -202,7 +202,6 @@ public class RapideLoader{
                                                                        }
 
                                                                        colIncl = (Boolean[])alColIncl.toArray(new Boolean[0]);
-
                                                                        sql_insert = "INSERT INTO " + tbName + "(";
                                                                        for(int j=0;j<colData.length;j++){
                                                                                for(int l=0;l<tb_col_count;l++){
@@ -237,7 +236,7 @@ public class RapideLoader{
                                                                                CmnUtils.infoPrinting(String.format("%1$-30s",tbName));
                                                                        } else {
                                                                                dao.rollback();
-                                                                               CmnUtils.debugPrint("column count is zero");
+                                                                               CmnUtils.debugPrint("\8ew\92è\82µ\82½\8bæ\90Ø\82è\95\8e\9a\82Å\82Ì\83J\83\89\83\80\90\94\82ª0\82Å\82·\81B");
                                                                                if(br != null){
                                                                                        br.close();
                                                                                        br=null;
@@ -257,7 +256,7 @@ public class RapideLoader{
                                                                        if(colData.length == fl_col_count){
                                                                                if(!strMltLine.equals("")){
                                                                                        dao.rollback();
-                                                                                       System.out.println(String.format("%1$10d",tb_rec_count) + " ERROR:column count is unmatch");
+                                                                                       CmnUtils.errorPrint("\8aY\93\96\83\8c\83R\81[\83h\82Ì\83J\83\89\83\80\90\94\82ª\83A\83\93\83}\83b\83`\82Å\82·\81B[" + tb_rec_count + "]");
                                                                                        CmnUtils.debugPrint("************Record End");
                                                                                        if(br != null){
                                                                                                br.close();
@@ -286,7 +285,7 @@ public class RapideLoader{
                                                                                                isContinue = false;
                                                                                        } else if(colData.length >fl_col_count){
                                                                                                dao.rollback();
-                                                                                               CmnUtils.errorPrint(String.format("%1$10d",tb_rec_count) + "column count is unmatch");
+                                                                                               CmnUtils.errorPrint("\8aY\93\96\83\8c\83R\81[\83h\82Ì\83J\83\89\83\80\90\94\82ª\83A\83\93\83}\83b\83`\82Å\82·\81B[" + tb_rec_count + "]");
                                                                                                CmnUtils.debugPrint("************Record End");
                                                                                                if(br != null){
                                                                                                        br.close();
@@ -432,7 +431,7 @@ public class RapideLoader{
                                                                                                        stmt_ins.setClob(j+1,null,0);
                                                                                                }
                                                                                        } else {
-                                                                                               CmnUtils.errorPrint("unmatch column type=" + colTypeName[tb_col_seq[j]]);
+                                                                                               CmnUtils.errorPrint("\83J\83\89\83\80\82Ì\83f\81[\83^\8c^\82ª\91Î\8fÛ\8aO\82Å\82·\81B[" + colTypeName[tb_col_seq[j]] + "]");
                                                                                                break TABLE_LOOP;
                                                                                        }
                                                                                }
@@ -453,7 +452,7 @@ public class RapideLoader{
                                                        }
                                                        if(!isLob)stmt_ins.executeBatch();
                                                        dao.commit();
-                                                       System.out.println(String.format("%1$10d",tb_rec_count) + " rows imported");
+                                                       System.out.println(String.format("%1$10d",tb_rec_count) + " \8d\83\8d\81[\83h\82³\82ê\82Ü\82µ\82½\81B");
                                                        CmnUtils.debugPrint("************Record End");
                                                        if(br != null){
                                                                br.close();
@@ -468,31 +467,33 @@ public class RapideLoader{
                                        }
                                }
                        } else {
-                               throw new Exception("Folder Not Found(" + folder + ")");
+                               CmnUtils.errorPrint("\93ü\97Í\8c³\83t\83H\83\8b\83_\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81B[" + folder + "]");
                        }
 
-                       dao.disconnect();
+                       CmnUtils.infoPrint("\83f\81[\83^\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
 
                } catch (Exception e) {
-                       dao.rollback();
-                       throw e;
+                       try{
+                               CmnUtils.errorPrint(e.toString());
+                               e.printStackTrace();
+                               dao.rollback();
+                       } catch (Exception ee) {}
                } finally{
-                       if(stmt != null){
-                               stmt.close();
-                               stmt=null;
-                       }
-                       if(stmt_ins != null){
-                               stmt_ins.close();
-                               stmt_ins=null;
-                       }
-                       if(br!=null){
-                               br.close();
-                               br=null;
-                       }
+                       try{
+                               dao.disconnect();
+                               if(stmt != null){
+                                       stmt.close();
+                                       stmt=null;
+                               }
+                               if(stmt_ins != null){
+                                       stmt_ins.close();
+                                       stmt_ins=null;
+                               }
+                               if(br!=null){
+                                       br.close();
+                                       br=null;
+                               }
+                       } catch (Exception e) {}
                }
-               CmnUtils.infoPrint("\83f\81[\83^\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
        }
-       
-
 }
-
index b62790a..7530302 100644 (file)
@@ -30,121 +30,6 @@ import java.sql.Timestamp;
 public class RapideUnloader{
        
        private String database = null;
-       private String driver = null;
-       private String user = null;
-       private String pass = null;
-       private String url = null;
-       private String tkSql;
-       private static final int DB_TYPE_ORACLE = 0;
-       private static final int DB_TYPE_SQLSERVER = 1;
-       private static final int DB_TYPE_DB2 = 2;
-       private static final int DB_TYPE_MYSQL = 3;
-       private static final int DB_TYPE_POSTGRESQL = 4;
-       private static final int DB_TYPE_UNKNOWN = -1;
-       private static final int MASK_PTN_ALL = 0;
-       private static final int MASK_PTN_ALT = 1;
-       private static final int MASK_PTN_EDGE = 2;
-       private static final int D_USER = 0;
-       private static final int D_PASS = 1;
-       private static final int D_URL = 2;
-       private static final int D_DRIVER = 3;
-       private static final int D_OUTPUT = 4;
-       private static final int D_INPUT = 5;
-       private static final int D_LINESEP = 6;
-       private static final int D_INLINESEP = 7;
-       private static final int D_FILENCODE = 8;
-       private static final int D_NULLMARK = 9;
-       private static final int D_DELIMITER = 10;
-       private static final int D_TBLSQL = 11;
-       private static final int D_TBLKEYSQL = 12;
-       private static final int D_ORDER = 13;
-       private static final int D_QUOTATION = 14;
-       private static final int D_BATCOUNT = 15;
-       private static final int D_INCLTAB = 16;
-       private static final int D_EXCLTAB = 17;
-       private static final int D_INCLCOL = 18;
-       private static final int D_EXCLCOL = 19;
-       private static final int D_INCLCOLMASK = 20;
-       private static final int D_EXCLCOLMASK = 21;
-       private static final int D_SBYTEMASKCHR = 22;
-       private static final int D_DBYTEMASKCHR = 23;
-       private static final int D_MASKPTN = 24;
-       private static final int D_PROPFILE = 25;
-       private static final int KEYS = 26;
-       private static final String [] DB_TYPE_NAME = {"ORACLE", "SQLSERVER", "DB2", "MYSQL", "POSTGRESQL"};
-       private static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"};
-       private static final String [] PROP_KEY = { "us","pw","url","dr","out","in","ls","ils","fe","nm",
-                                                                                               "dm","ts","tks","od","qt","bc","it","et","ic","ec",
-                                                                                               "icm","ecm","smc","dmc","mp","pf"};
-       private static final String DEFAULT_FOLDER              = "output";
-       private static final String DEFAULT_PROP_FILE   = "RapideLoader.properties";
-
-       private String nullMark                                 = "";
-       private boolean isOrder                                 = false;
-       private boolean isQuotation                     = true;
-       private boolean isInclTables                    = false;
-       private boolean isExclTables                    = false;
-       private boolean isInclCols                              = false;
-       private boolean isExclCols                              = false;
-       private boolean isMask                                  = false;
-       private boolean isInclColsMask                  = false;
-       private boolean isExclColsMask                  = false;
-       private String delimiter                                = "\t";
-       private String lineSeparator                    = System.getProperty("line.separator");
-       private String inColLineSeparator               = System.getProperty("line.separator");
-       private String outFolder                                = null;
-       private String inFolder                                 = null;
-       private String inclTables                               = null;
-       private String exclTables                               = null;
-       private String inclCols                                 = null;
-       private String exclCols                                 = null;
-       private String inclMaskCols                     = null;
-       private String exclMaskCols                     = null;
-       private String [] inclTablesArray               = null;
-       private String [] exclTablesArray               = null;
-       private String [] inclColsArray                         = null;
-       private String [] exclColsArray                         = null;
-       private String [] inclColsMaskArray             = null;
-       private String [] exclColsMaskArray             = null;
-       private char singleByteMaskChar                 = '*';
-       private char doubleByteMaskChar                 = '\u25A0';
-       private String maskPattern                              = "ALT";
-       private String fileEncoding                     = System.getProperty("file.encoding");
-       
-       private String [] prop_val = new String[KEYS];
-       
-
-       private static String [] tkSqlArray = {
-               "select "
-               + "a.table_name,"
-               + "d.column_name "
-               + " from user_tables a,"
-               + " (select b.table_name, "
-               + "   c.column_name, "
-               + "   c.position "
-               + "  from user_constraints b, "
-               + "       user_cons_columns c "
-               + "  where b.CONSTRAINT_TYPE = 'P' and "
-               + "        b.TABLE_NAME = c.TABLE_NAME and "
-               + "        b.CONSTRAINT_NAME = c.CONSTRAINT_NAME "
-               + "  ) d "
-               + "where a.table_name = d.table_name(+) "
-               + "order by a.table_name, d.position",
-               "SELECT "
-               + " A.name AS table_name, "
-               + " D.name AS col_name "
-               + "FROM sys.tables AS A "
-               + "LEFT OUTER JOIN sys.key_constraints AS B "
-               + "ON A.object_id = B.parent_object_id "
-               + " AND B.type = 'PK' "
-               + "LEFT OUTER JOIN sys.index_columns AS C "
-               + "ON B.parent_object_id = C.object_id "
-               + " AND B.unique_index_id = C.index_id "
-               + "LEFT OUTER JOIN sys.columns AS D "
-               + "ON C.object_id = D.object_id "
-               + " AND C.column_id = D.column_id "
-               + "order by A.name,C.key_ordinal"
-       };
 
        public static void main(String args[]){
                try {
@@ -160,43 +45,14 @@ public class RapideUnloader{
                }
        }
 
-       RapideUnloader(String _database) throws Exception{
+       RapideUnloader(String _database) {
                super();
                database = _database;
 
        }
 
-       private void getProperties(String _propFile) throws Exception{
-               BufferedReader br = null;
-               Properties prop = null;
-               try {
-                       prop = new Properties();
-                       br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(_propFile), "UTF-8"));
-                       prop.load(br);
-                       for(int i=0;i<KEYS;i++){
-                               prop_val[i] = prop.getProperty(database + "." +PROP_KEY[i]);
-                       }
-                       br.close();
-                       br = null;
-               } catch (NullPointerException e) {
-                               throw new Exception("Property File (" + _propFile +") Not Found");
-               } catch (IOException e) {
-                               throw e;
-               }
-               finally{
-                       try {
-                               if (br != null) {
-                                       br.close();
-                                       br = null;
-                               }
-                       } 
-                       catch (IOException e) {
-                               throw e;
-                       }
-               }               
-       }
 
-       private void unload() throws Exception{
+       private void unload() {
                Connection conn                                 = null;
                PreparedStatement stmt                  = null;
                ResultSet rst                                   = null;
@@ -204,10 +60,9 @@ public class RapideUnloader{
                String sql_insert                               = null;
                String order_columns                    = "";
                int orders                                              = 0;
-               int dbType                                              = DB_TYPE_UNKNOWN;
 
                PrintWriter pw                                  = null;
-               File fldr                                               = null;
+               File folder                                             = null;
                ArrayList<String>  alColName    = null;
                ArrayList<String>  alColTypeName = null;
                ArrayList<Integer> alIsNullable = null;
@@ -216,120 +71,29 @@ public class RapideUnloader{
                ArrayList<String>  alData               = null;
                int tb_count                                    = 0;
                int tb_col_count                                = 0;
+               CmnProperty cp = null;
+               DataAccessObjects dao = null;
 
-
-
-               if(database != null){
-                       if(!CmnUtils.isEmpty(prop_val[D_PROPFILE])){
-                               getProperties(System.getProperty(prop_val[D_PROPFILE]));
-                       } else {
-                               getProperties(DEFAULT_PROP_FILE);
-                       }
-               }
-               
-               for(int i=0;i<KEYS;i++){
-                       if(System.getProperty(PROP_KEY[i])!=null)prop_val[i] = System.getProperty(PROP_KEY[i]);
-                       CmnUtils.debugPrint(PROP_KEY[i] + "=" + prop_val[i]);
-               }
-               
-               if(!CmnUtils.isEmpty(prop_val[D_USER]))user = prop_val[D_USER];
-               if(!CmnUtils.isEmpty(prop_val[D_PASS]))pass = prop_val[D_PASS];
-               if(!CmnUtils.isEmpty(prop_val[D_URL]))url = prop_val[D_URL];
-               if(!CmnUtils.isEmpty(prop_val[D_DRIVER]))driver = prop_val[D_DRIVER];
-               if(!CmnUtils.isEmpty(prop_val[D_ORDER]) && prop_val[D_ORDER].toUpperCase().equals("Y"))isOrder = true;
-               if(!CmnUtils.isEmpty(prop_val[D_QUOTATION]) && prop_val[D_QUOTATION].toUpperCase().equals("N"))isQuotation = false;
-               if(!CmnUtils.isEmpty(prop_val[D_INCLTAB]))isInclTables = true;
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLTAB]))isExclTables = true;
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOL]))isInclCols = true;
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOL]))isExclCols = true;
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOLMASK]))isInclColsMask = true;
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOLMASK]))isExclColsMask = true;
-               if(isInclColsMask || isExclColsMask)isMask = true;
-               if(!CmnUtils.isEmpty(prop_val[D_DELIMITER]))delimiter = CmnUtils.getDelimiter(prop_val[D_DELIMITER]);
-               if(!CmnUtils.isEmpty(prop_val[D_LINESEP]))lineSeparator = CmnUtils.getLineSeparator(prop_val[D_LINESEP]);
-               if(!CmnUtils.isEmpty(prop_val[D_OUTPUT]))outFolder = prop_val[D_OUTPUT];
-               if(!CmnUtils.isEmpty(prop_val[D_INCLTAB]))inclTables = prop_val[D_INCLTAB].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLTAB]))exclTables = prop_val[D_EXCLTAB].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOL]))inclCols = prop_val[D_INCLCOL].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOL]))exclCols = prop_val[D_EXCLCOL].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOLMASK]))inclMaskCols = prop_val[D_INCLCOLMASK].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOLMASK]))exclMaskCols = prop_val[D_EXCLCOLMASK].toUpperCase();
-               if(!CmnUtils.isEmpty(prop_val[D_INCLTAB]))inclTablesArray = CmnUtils.splitCsv(prop_val[D_INCLTAB].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLTAB]))exclTablesArray = CmnUtils.splitCsv(prop_val[D_EXCLTAB].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOL]))inclColsArray = CmnUtils.splitCsv(prop_val[D_INCLCOL].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOL]))exclColsArray = CmnUtils.splitCsv(prop_val[D_EXCLCOL].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_INCLCOLMASK]))inclColsMaskArray = CmnUtils.splitCsv(prop_val[D_INCLCOLMASK].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_EXCLCOLMASK]))exclColsMaskArray = CmnUtils.splitCsv(prop_val[D_EXCLCOLMASK].toUpperCase());
-               if(!CmnUtils.isEmpty(prop_val[D_SBYTEMASKCHR]))singleByteMaskChar = prop_val[D_SBYTEMASKCHR].charAt(0);
-               if(!CmnUtils.isEmpty(prop_val[D_DBYTEMASKCHR]))doubleByteMaskChar = prop_val[D_DBYTEMASKCHR].charAt(0);
-               if(!CmnUtils.isEmpty(prop_val[D_MASKPTN]))maskPattern = prop_val[D_MASKPTN];
-               if(!CmnUtils.isEmpty(prop_val[D_FILENCODE]))fileEncoding = prop_val[D_FILENCODE];
-
-               if(user == null){
-                       throw new Exception("user is null");
-               } else if (pass == null){
-                       throw new Exception("password is null");
-               } else if (url == null){
-                       throw new Exception("url is null");
-               } else if (driver == null){
-                       throw new Exception("driver is null");
-               }
-               
-               for(int i = 0;i<DB_TYPE_NAME.length;i++){
-                       if (url.toUpperCase().contains(DB_TYPE_NAME[i])){
-                               dbType = i;
-                               break;
-                       }
-               }
-               
-               if (dbType != DB_TYPE_UNKNOWN){
-                       if(!CmnUtils.isEmpty(prop_val[D_TBLKEYSQL])){
-                               tkSql = prop_val[D_TBLKEYSQL];
-                       } else {
-                               tkSql = tkSqlArray[dbType];
-                       }
-               } else {
-                       throw new Exception("dbtype unknown");
-               }
-
-               DataAccessObjects dao = new DataAccessObjects(user, pass, url, driver);
-               dao.setPropVal(prop_val);
                try {
-                       conn = dao.connect();
+                       cp = new CmnProperty();
+                       cp.setProperty(database);
                        
-                       if(outFolder != null){
-                               fldr = new File(outFolder);
+                       if(cp.outFolder != null){
+                               folder = new File(cp.outFolder);
                        } else {
                                if(database != null){
-                                       fldr = new File(DEFAULT_FOLDER + "/" + database.toUpperCase() + "_" + CmnUtils.getYmdhm());
+                                       folder = new File(cp.DEFAULT_OUT_FOLDER + "/" + database.toUpperCase() + "_" + CmnUtils.getYmdhm());
                                } else {
-                                       fldr = new File(DEFAULT_FOLDER + "/" + DB_TYPE_NAME[dbType].toUpperCase() + "_" + CmnUtils.getYmdhm());
+                                       folder = new File(cp.DEFAULT_OUT_FOLDER + "/" + cp.DB_TYPE_NAME[cp.dbType].toUpperCase() + "_" + CmnUtils.getYmdhm());
                                }
-                               fldr.mkdir();
+                               folder.mkdir();
                        }
                        
-                       if(database!=null)CmnUtils.infoPrint("-->Database='" + database.toUpperCase() + "'");
-                       CmnUtils.infoPrint("-->Output='" + fldr + "'");
-                       if(!CmnUtils.isEmpty(prop_val[D_DELIMITER]))CmnUtils.infoPrint("-->Delimiter='" + prop_val[D_DELIMITER] + "'");
-                       if(!CmnUtils.isEmpty(prop_val[D_LINESEP]))CmnUtils.infoPrint("-->LineSeparator='" + prop_val[D_LINESEP] + "'");
-                       if(!CmnUtils.isEmpty(prop_val[D_FILENCODE]))CmnUtils.infoPrint("-->FileEncoding='" + prop_val[D_FILENCODE] + "'");
-                       if(!CmnUtils.isEmpty(prop_val[D_QUOTATION]))CmnUtils.infoPrint("-->Quotation=" + CmnUtils.getYesNo(isQuotation));
-                       if(!CmnUtils.isEmpty(prop_val[D_ORDER]))CmnUtils.infoPrint("-->Sort=" + CmnUtils.getYesNo(isOrder));
-                       if(isInclTables)CmnUtils.infoPrint("-->Include Tables='" + inclTables.toUpperCase() + "'");
-                       if(isExclTables)CmnUtils.infoPrint("-->Exclude Tables='" + exclTables.toUpperCase() + "'");
-                       if(isInclCols)CmnUtils.infoPrint("-->Include Columns='" + inclCols.toUpperCase() + "'");
-                       if(isExclCols)CmnUtils.infoPrint("-->Exclude Columns='" + exclCols.toUpperCase() + "'");
-                       if(isMask){
-                               CmnUtils.infoPrint("-->Masking=" + CmnUtils.getYesNo(isMask));
-                               CmnUtils.infoPrint("-->Masking Pattern=" + maskPattern.toUpperCase());
-                               if(isInclColsMask)CmnUtils.infoPrint("-->Masking Columns='" + inclMaskCols.toUpperCase() + "'");
-                               if(isExclColsMask)CmnUtils.infoPrint("-->Exclude Masking Columns='" + exclMaskCols.toUpperCase() + "'");
-                               CmnUtils.infoPrint("-->Single Byte Mask Char='" + singleByteMaskChar + "'");
-                               CmnUtils.infoPrint("-->Double Byte Mask Char='" + doubleByteMaskChar + "'");
-                       }
-                       CmnUtils.infoPrint("Start DataUnload ---------------------------------------------");
-
-                       dao.select(tkSql);
+                       CmnUtils.infoPrint("-->\8fo\97Í\90æ\83t\83H\83\8b\83_='" + folder + "'");
+                       CmnUtils.infoPrint("\83f\81[\83^\83A\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82µ\82½\81B");
+                       dao = new DataAccessObjects(cp);
+                       conn = dao.connect();
+                       dao.select(cp.tkSql);
                        alData = dao.getArrayList();
                        tb_count = dao.getColumnCount();
                        orders = 0;
@@ -338,22 +102,22 @@ public class RapideUnloader{
                        for(int i=0;i<alData.size();i++){
                                if ((i+1) % tb_count == 1){
                                        if ((i + 2 <alData.size()) && (!alData.get(i).equals(alData.get(i+2))) || (i + 2 == alData.size())) {
-                                               if(isInclTables && !CmnUtils.isMatch(inclTablesArray,alData.get(i).toUpperCase())){
-                                                       CmnUtils.debugPrint("inclTables=" + inclTables);
-                                                       CmnUtils.debugPrint("table=" + alData.get(i) + "," +CmnUtils.isMatch(inclTablesArray,alData.get(i).toUpperCase()));
+                                               if(cp.isInclTables && !CmnUtils.isMatch(cp.inclTablesArray,alData.get(i).toUpperCase())){
+                                                       CmnUtils.debugPrint("cp.inclTables=" + cp.inclTables);
+                                                       CmnUtils.debugPrint("table=" + alData.get(i) + "," +CmnUtils.isMatch(cp.inclTablesArray,alData.get(i).toUpperCase()));
                                                        orders = 0;
                                                        order_columns = "";
                                                        continue;
                                                }
-                                               if(isExclTables && CmnUtils.isMatch(exclTablesArray,alData.get(i).toUpperCase())){
-                                                       CmnUtils.debugPrint("exclTables=" + exclTables);
-                                                       CmnUtils.debugPrint("table=" + alData.get(i) + "," +CmnUtils.isMatch(exclTablesArray,alData.get(i).toUpperCase()));
+                                               if(cp.isExclTables && CmnUtils.isMatch(cp.exclTablesArray,alData.get(i).toUpperCase())){
+                                                       CmnUtils.debugPrint("cp.exclTables=" + cp.exclTables);
+                                                       CmnUtils.debugPrint("table=" + alData.get(i) + "," +CmnUtils.isMatch(cp.exclTablesArray,alData.get(i).toUpperCase()));
                                                        orders = 0;
                                                        order_columns = "";
                                                        continue;
                                                }
                                                if (!alData.get(i+1).equals("")){
-                                                       if(isOrder){
+                                                       if(cp.isOrder){
                                                                if (orders == 0){
                                                                        if (!alData.get(i+1).equals(""))order_columns = alData.get(i+1);
                                                                } else {
@@ -362,7 +126,7 @@ public class RapideUnloader{
                                                                orders++;
                                                        }
                                                }                                                       
-                                               if(isOrder){
+                                               if(cp.isOrder){
                                                        if(!order_columns.equals("")){
                                                                sql_unload = "select * from " + alData.get(i) + " order by " + order_columns;
                                                        } else {
@@ -382,20 +146,20 @@ public class RapideUnloader{
                                                tb_col_count = dao.getColumnCount();
                                                for(int j=0;j<alColName.size();j++){
                                                        if(CmnUtils.isColString(alColTypeName.get(j))){
-                                                               if(isMask){
+                                                               if(cp.isMask){
                                                                        if(
-                                                                               (isInclColsMask && 
-                                                                                !isExclColsMask &&
-                                                                                CmnUtils.isMatch(inclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
+                                                                               (cp.isInclColsMask && 
+                                                                                !cp.isExclColsMask &&
+                                                                                CmnUtils.isMatch(cp.inclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
                                                                                ) ||
-                                                                               (isInclColsMask && 
-                                                                                isExclColsMask &&
-                                                                                CmnUtils.isMatch(inclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase()) &&
-                                                                                !CmnUtils.isMatch(exclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
+                                                                               (cp.isInclColsMask && 
+                                                                                cp.isExclColsMask &&
+                                                                                CmnUtils.isMatch(cp.inclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase()) &&
+                                                                                !CmnUtils.isMatch(cp.exclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
                                                                                ) ||
-                                                                               (!isInclColsMask && 
-                                                                                isExclColsMask &&
-                                                                                !CmnUtils.isMatch(exclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
+                                                                               (!cp.isInclColsMask && 
+                                                                                cp.isExclColsMask &&
+                                                                                !CmnUtils.isMatch(cp.exclColsMaskArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
                                                                                ) 
                                                                        ){
                                                                                CmnUtils.debugPrint("Mask Column=" + alColName.get(j).toUpperCase());
@@ -409,20 +173,20 @@ public class RapideUnloader{
                                                        } else {
                                                                alColMask.add(false);
                                                        }
-                                                       if(isInclCols || isExclCols){
+                                                       if(cp.isInclCols || cp.isExclCols){
                                                                if(
-                                                                       (isInclCols && 
-                                                                        !isExclCols &&
-                                                                        CmnUtils.isMatch(inclColsArray,alData.get(i).toUpperCase(), alColName.get(j).toUpperCase())
+                                                                       (cp.isInclCols && 
+                                                                        !cp.isExclCols &&
+                                                                        CmnUtils.isMatch(cp.inclColsArray,alData.get(i).toUpperCase(), alColName.get(j).toUpperCase())
                                                                        ) ||
-                                                                       (isInclCols && 
-                                                                        isExclCols &&
-                                                                        CmnUtils.isMatch(inclColsArray,alData.get(i).toUpperCase(), alColName.get(j).toUpperCase()) &&
-                                                                        !CmnUtils.isMatch(exclColsArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
+                                                                       (cp.isInclCols && 
+                                                                        cp.isExclCols &&
+                                                                        CmnUtils.isMatch(cp.inclColsArray,alData.get(i).toUpperCase(), alColName.get(j).toUpperCase()) &&
+                                                                        !CmnUtils.isMatch(cp.exclColsArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
                                                                        ) ||
-                                                                       (!isInclCols && 
-                                                                        isExclCols &&
-                                                                        !CmnUtils.isMatch(exclColsArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
+                                                                       (!cp.isInclCols && 
+                                                                        cp.isExclCols &&
+                                                                        !CmnUtils.isMatch(cp.exclColsArray,alData.get(i).toUpperCase(),alColName.get(j).toUpperCase())
                                                                        )
                                                                ){
                                                                        CmnUtils.debugPrint("column=" + alColName.get(j).toUpperCase());
@@ -455,12 +219,12 @@ public class RapideUnloader{
                                                dao.setArrayColumnMaskList(alColMask);
                                                
                                                if (lastCol >= 0){
-                                                       pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fldr + "/" + alData.get(i) + ".csv"), fileEncoding)));
+                                                       pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(folder + "/" + alData.get(i) + ".csv"), cp.fileEncoding)));
                                                        CmnUtils.infoPrinting(String.format("%1$-30s",alData.get(i)));
 
                                                        for(int j=0;j<alColName.size();j++){
                                                                if(j==firstCol){
-                                                                       if(isQuotation){
+                                                                       if(cp.isQuotation){
                                                                                pw.print("\"" + alColName.get(j));
                                                                        } else {
                                                                                pw.print(alColName.get(j));
@@ -469,24 +233,24 @@ public class RapideUnloader{
                                                                        if(colIncl[j])pw.print(alColName.get(j));
                                                                }
                                                                if (firstCol == lastCol){
-                                                                       if(isQuotation){
-                                                                               pw.print("\"" + lineSeparator);
+                                                                       if(cp.isQuotation){
+                                                                               pw.print("\"" + cp.lineSeparator);
                                                                        } else {
-                                                                               pw.print("" + lineSeparator);
+                                                                               pw.print("" + cp.lineSeparator);
                                                                        }
                                                                } else {
                                                                        if (j==lastCol){
-                                                                               if(isQuotation){
-                                                                                       pw.print("\"" + lineSeparator);
+                                                                               if(cp.isQuotation){
+                                                                                       pw.print("\"" + cp.lineSeparator);
                                                                                } else {
-                                                                                       pw.print("" + lineSeparator);
+                                                                                       pw.print("" + cp.lineSeparator);
                                                                                }
                                                                        } else {
                                                                                if(colIncl[j]){
-                                                                                       if(isQuotation){
-                                                                                               pw.print("\"" + delimiter + "\"");
+                                                                                       if(cp.isQuotation){
+                                                                                               pw.print("\"" + cp.delimiter + "\"");
                                                                                        } else {
-                                                                                               pw.print(delimiter);
+                                                                                               pw.print(cp.delimiter);
                                                                                        }
                                                                                }
                                                                        }
@@ -496,13 +260,13 @@ public class RapideUnloader{
                                                        dao.closeRecordSet();
                                                        pw.close();
                                                        pw = null;
-                                                       System.out.println(String.format("%1$10d",dao.getRecCount()) + " rows exported");
+                                                       System.out.println(String.format("%1$10d",dao.getRecCount()) + " \8d\83A\83\93\83\8d\81[\83h\82³\82ê\82Ü\82µ\82½\81B");
                                                }
                                                orders = 0;
                                                order_columns = "";
                                        } else {
                                                if (!alData.get(i+1).equals("")){
-                                                       if(isOrder){
+                                                       if(cp.isOrder){
                                                                if (orders == 0){
                                                                        if (!alData.get(i+1).equals(""))order_columns = alData.get(i+1);
                                                                } else {
@@ -517,17 +281,27 @@ public class RapideUnloader{
                                }
                        }
 
-                       dao.disconnect();
+                       CmnUtils.infoPrint("\83f\81[\83^\83A\83\93\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
 
                } catch (Exception e) {                 
-                       throw e;
+                       try{
+                               CmnUtils.errorPrint(e.toString());
+                               e.printStackTrace();
+                               dao.rollback();
+                       } catch (Exception ee) {}
                } finally{
-                       if(pw!=null){
-                               pw.close();
-                               pw=null;
-                       }
+                       try{
+                               dao.disconnect();
+                               if(stmt != null){
+                                       stmt.close();
+                                       stmt=null;
+                               }
+                               if(pw!=null){
+                                       pw.close();
+                                       pw=null;
+                               }
+                       } catch (Exception e) {}
                }
-               CmnUtils.infoPrint("End DataUnload -----------------------------------------------");
        }