【jsp】数据库多线程连接.docxVIP

  • 2
  • 0
  • 约2.06千字
  • 约 4页
  • 2018-03-16 发布于河南
  • 举报
【jsp】数据库多线程连接

public class MyDataSource { private static String url = jdbc:mysql://localhost:3306/test; private static String user = root; private static String password = 1111; private static int initcount = 10;// 初始化连接的个数 private static int maxcount = 20;;// 最大的连接数 private static int currentcount = 0;// 当前连接 LinkedListConnection connectionsPool = new LinkedListConnection(); // 创建10个连接,依次放入linkedlist的链尾 public MyDataSource() { try { for (int i = 0; i initcount; i++) { this.connectionsPool.addLast(this.createConnection()); this.currentcount++; // 记录当前连接数 } } catch (SQLException e) { throw new ExceptionInIn

文档评论(0)

1亿VIP精品文档

相关文档