





















StringBuffer sb = new StringBuffe();
sb.append(str[1] + "#XT#");
sb.append(str[2]+"#XT#");
sb.append("\n");
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);
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。