package myJDBC;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class TestConnectionpool {
public static void main(String[] args) {
long time1=System.currentTimeMillis();
Thread[] t1=new Thread[100];
Connectionpool pool=new Connectionpool(10);
String sql="insert into hero value(NULL,'hero',100,100)";
for(int i=0;i<100;i++) {
Thread t=new ConnectionpoolThread(pool);
t1[i]=t;
t.start();
}
for(Thread t:t1) {
try {
t.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
long time2=<
数据库连接池和多线程
最新推荐文章于 2022-06-22 18:57:45 发布