commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rhett Wang <palmer0...@gmail.com>
Subject [DBCP]-stuck when over MaxActive
Date Thu, 08 Apr 2010 19:28:52 GMT
 private static BasicDataSource ds = new BasicDataSource();

  public static void setupDataSource(
BasicDataSource bds) {
        bds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
        bds.setUsername("hr");
        bds.setPassword("hr");
        url="jdbc:oracle:thin:@test:1524:dev1";
        bds.setUrl(url);
        bds.setInitialSize(5);
        bds.setMaxActive(20);
        bds.setMinIdle(5);
        bds.setRemoveAbandoned(true);
        bds.setRemoveAbandonedTimeout(5);
        bds.setValidationQueryTimeout(0);
    }
public static void main(String[] agv){
     setupDataSource(ds);
     for (int i=0; i<30;i++){
            System.out.println("try to get conn "+i);
            Connection connTemp = ds.getConnection();
       }
}

When the number of connection is  over MaxActive(20), it is stuck!


Could you help me clarify it?

I know we should close the Connection, but here I just test it.


-- 
Rhett

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message