1、采用公认的MYSQL最快批量提交办法
public void index() throws UnsupportedEncodingException,
Exception
{
//1000个一提交
int COMMIT_SIZE=25000;
//一共多少个
int COUNT=100000;
long a=System.currentTimeMillis();
Connection conn= null;
try {
Class.forName("com.mysql.jdbc.Driver"); String
url="jdbc:mysql://10.10.3.13/new_lxyy_db?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true";
String user="root";
String password="dsideal";
conn= DriverManager.getConnection(url,user,password);
long starTime = System.currentTimeMillis();
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement("load data local
infile '' "+ "into table loadtest fields terminated by
','");
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= COUNT; i++)
{
sb.append(i + "," + i+"abc" + "\n");
if (i % COMMIT_SIZE == 0) {
InputStream is = new
<