public static boolean saveSynset_02_365zn(List synsetcns, String tableName) { openDB(); String sql = "insert into " + tableName + "(Synset_id,W_num,Chinese) values(?,?,?)"; System.out.println(sql); try { ps = conn.prepareStatement(sql); for (Synsetcn synsetcn : synsetcns) { ps.setString(1, synsetcn.getSynset_id()); ps.setInt(2, synsetcn.getW_num()); ps.setString(3, synsetcn.getChinese()); ps.addBatch(); } ps.executeBatch(); closeDB(); return true; } catch (SQLException e) { e.printStackTrace(); return false; } }
使用JDBC批量插入数据
最新推荐文章于 2023-09-22 08:30:00 发布