1 Star 0 Fork 16

devlop/java

forked from 加州阳光vpk/java 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Test2.java 736 Bytes
一键复制 编辑 原始数据 按行查看 历史
bjmashibing 提交于 2019-12-08 19:17 +08:00 . update
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Test2 {
public static void main(String[] args) throws Exception{
long starttime = System.currentTimeMillis();
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.85.111:3306/sakila","root","123456");
PreparedStatement pstmt = conn.prepareStatement("insert into userinfo(name) values(?)");
for (int i = 0; i < 1000000; i++) {
pstmt.setString(1,i+"");
pstmt.addBatch();
}
pstmt.executeBatch();
conn.close();
System.out.println(System.currentTimeMillis()-starttime);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/devlop/java.git
git@gitee.com:devlop/java.git
devlop
java
java
master

搜索帮助