专注网页设计制作教程: http://www.update8.com

一个支持双数据库的DB连接池

时间:2011-04-22 10:52点击: 次 【

可以配2个不同的数据库,  速度还可以
10000000次8秒种

[文件] 支持双数据库的DB连接池.rar ~ 146KB    下载

[Java]代码

public class text
{
	public static void main(String[] args) throws SQLException
	{
		long start2 = System.currentTimeMillis();
		Connection conn = null;
		for(int i = 1; i < 10000000; i++)
		{
			conn = DB.getConn(1);
			conn.close();
		}
		System.out.println("经过10000000次的循环调用,使用连接池花费的时间" + (System.currentTimeMillis() - start2) + "ms\n");	
	}
}

[图片] 程序演示.gif

------分隔线----------------------------
相关文章