StringBuffer sb = new StringBuffe(); sb.append(str[1] + "#XT#"); sb.append(str[2]+"#XT#"); sb.append(" "); byte date[] = sb.toString().getBytes(); InputStream in = new ByteArrayInputStream(date); insertBeach(in); sb = new StringBuffer(); public static void insertBeach(InputStream in){ try{ conn = Util.getConnect(); String sql = "load data local infile 'sql.scv' ignore table Base.table fields terminated by '#XT#' "; ps = conn.prepareStatement (sql); if(ps.isWrapperFor(com.mysql.jdbc.Statement.class)){ com.mysql.jdbc.PreparedStatement pst = ps.unwrap(com.mysql.jdbc.PreparedStatement.class); pst.setLocalInfileInputStream(in); pst.executeUpdate() } }catch(Exception e){ e.printStackTrace(); }finally{ closePs(ps); closeConn(conn); } }