1.
2.  
 b) C3P0 
       /**  *  3.  int max_count = 6; // new LinkedList<Connection>();     //1.  int i=0; i<init_count; i++){ // 
 //  try { Class.forName(“com.mysql.jdbc.Driver”); // 
 // 
 new InvocationHandler() { // 
 //  System.out.println(“begin:
 System.out.println(“end: 
 } return result; } } ); return proxy; } catch (Exception e) { throw new RuntimeException(e); } }   //3.  return pool.removeFirst(); }   // 3.2 
 // new RuntimeException(“void realeaseConnection(Connection con) { // 4.1 
 con.close(); } catch (SQLException e) { throw new RuntimeException(e); } } }   public static void main(String[] args) throws SQLException { MyPool pool = new MyPool(); System.out.println(“
 pool.getConnection(); Connection con4 = pool.getConnection(); Connection con3 = pool.getConnection(); Connection con2 = pool.getConnection(); Connection con1 = pool.getConnection();   // 
   System.out.println(“
 }   }     
   
   public class App_DBCP {   // 1. 
 // 
 // 
 }   @Test // 2. 
 // 
 // 
 con.prepareStatement(“delete from admin where id=4”).executeUpdate(); // 
 配置方式实现
     public class App {   @Test //1. new ComboPooledDataSource(); // 
 // 
 }   @Test //2. XMLnew ComboPooledDataSource();// 
 // 
   } }     
                                                         声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!
 
 
1.2 C3P0
 
 
1.3