Java mysql batch 提速 "rewriteBatchedStatements=true"
2012-01-19 21:00
295 查看
Mysql jdbc 批处理数据,需要给jdbc连接加上rewriteBatchedStatements=true。默认jdbc是不会开启批处理。
例如:jdbc:mysql://10.250.4.98:3306/dbname?rewriteBatchedStatements=true
Java UpdateBatchSample:
http://www.java2s.com/Code/Java/Database-SQL-JDBC/BatchupdateforMySQL.htm
官网forums
http://forums.mysql.com/read.php?39,260053,263456#msg-263456
MySQL itself has no real "batch" API for prepared statements. If you add the configuration property "rewriteBatchedStatements=true" to your JDBC connection string for Connector/J, the driver will rewrite batches of prepared INSERTs into multi-value form, and all other forms of statements into multi-statements, which does give a large performance gain (7-10x).
注意:
jdbc driver 版本需要 5.1.8 及以上
例如:jdbc:mysql://10.250.4.98:3306/dbname?rewriteBatchedStatements=true
Java UpdateBatchSample:
http://www.java2s.com/Code/Java/Database-SQL-JDBC/BatchupdateforMySQL.htm
官网forums
http://forums.mysql.com/read.php?39,260053,263456#msg-263456
MySQL itself has no real "batch" API for prepared statements. If you add the configuration property "rewriteBatchedStatements=true" to your JDBC connection string for Connector/J, the driver will rewrite batches of prepared INSERTs into multi-value form, and all other forms of statements into multi-statements, which does give a large performance gain (7-10x).
注意:
jdbc driver 版本需要 5.1.8 及以上
相关文章推荐
- 使mysql executeBatch生效 设置rewriteBatchedStatements=true,用mysql-connector-java-5.1.34-bin.jar
- java mysql 高性能批量处理 设置rewriteBatchedStatements
- MySQL Jdbc驱动的rewriteBatchedStatements参数
- MySQL Jdbc驱动的rewriteBatchedStatements参数--批量修改开关
- Java中连结MySQL启用预编译的先决条件是useServerPstmts=true.
- Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
- java数据库连接(mysql)java.sql.SQLExcept "Host 'Lenovo-PC' is not allowed to connect to this MySQL server"
- java中 string和int boolean类型值true和String String类型值"true"和boolean类型 三种相互转换
- Java---Which four statements are true
- Java中连结MySQL启用预编译的先决条件是useServerPstmts=true.
- java mysql 高性能批量处理 设置rewriteBatchedStatements
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- 在java中String a="a",b="a";a==b为什么返回true?
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- JDBC rewriteBatchedStatements对批量插入的影响
- 为什么 Java中1000==1000为false而100==100为true?AND "2+2=5"?
- PowerDesigned15连接MySQL出现"Could not initialize JavaVM"时的详细解决步骤(图文)
- java中mysql关于useSSL=true
- [Java细节]"hi there".equals("cheers !") == true
- 异常信息:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver