使用JDBC连接MySQL数据库进行数据插入的时候,特别是大批量数据连续插入(10W+),如何提高效率呢? 在JDBC编程接口中Statement 有两个方法特别值得注意: void addBatch() throws SQLException Adds a set of parameters to this PreparedStatement object's batch of commands. int[] executeBatch() throws SQLException Submits…
简单举个例子: drop table if exists demo1 create table demo1 ( id int primary key auto_increment, name ) ) desc demo1 -- 随机字符串函数用于插入数据 drop function if exists rand_str; delimiter // create function rand_str(size int,type int) ) begin ) ; ) '; ) default 'q…
原文:http://blog.csdn.net/tomcat_2014/article/details/53377924 delimiter $$ create procedure myproc () begin declare num int ; ; do INSERT INTO rd_user (user_name, add_time, MOBILE_PHONE) VALUES (CONCAT('test',num), now(), NULL); ; end while ; end$$ --…