Hi Cyrille,
Thanks!
That is the answer!
Rhett
On Thu, Apr 8, 2010 at 2:18 PM, Cyrille <cyrille.roy@free.fr> wrote:
> Hi,
> I think this is related to maxWait.
>
> Take a look at:
> http://commons.apache.org/dbcp/configuration.html
>
> ==> maxWait indefinitely The maximum number of milliseconds that the pool
> will wait (when there are no available connections) for a connection to be
> returned before throwing an exception, or -1 to wait indefinitely.
>
> Regards,
> Cyrille.
>
> Le 08/04/10 21:28, Rhett Wang a écrit :
>
> 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.
>>
>>
>>
>>
>
|