惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
WordPress大学
WordPress大学
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
博客园 - Franky
D
Docker
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
U
Unit 42
M
MIT News - Artificial intelligence
B
Blog
GbyAI
GbyAI
C
Check Point Blog
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
IT之家
IT之家
Google DeepMind News
Google DeepMind News
V
V2EX
Stack Overflow Blog
Stack Overflow Blog

博客园 - zqzdong

word 宏(图片锐度和对比度) Maven父子结构的项目依赖使用以及打包依赖 在linux下执行不带主函数的jar Maven项目打包 eclipse调用c语言类库 scala rdd的交集 差集 并集 cdh 的 oozie时间校准 java 调用c语言类库 java jar包代码混淆 在windows下查找java服务cup过高问题 AES 加密解密 logger日志配置 hadoop安装 flume配置及其执行命令 kafka配置及其使用 kafkaConsumer(从topic 拿数据存入hdfs) 自定义flume的sink mongodb3.2链接设置 在mongodb中存值,如果存在则修改,不存在插入
java批量导入数据
zqzdong · 2017-02-24 · via 博客园 - zqzdong
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);
    }
}

posted @ 2017-02-24 16:08  zqzdong  阅读(946)  评论()    收藏  举报