Connection-Pooling using java for oracle

Discussions

Performance and scalability: Connection-Pooling using java for oracle

  1. Connection-Pooling using java for oracle (2 messages)

    Hi,
    I have a java class in which i use oracle.jdbc.pool classes to create connections with an oracle 9i database. A snippet of the code is as below:
    ***************************
    Pool = new OracleConnectionPoolDataSource();
    Pool.setUser("scott");
    Pool.setPassword("tiger");
    Pool.setURL("jdbc:oracle:oci:@SERVICENAME");

    PoolCache = new OracleConnectionCacheImpl(Pool);
    PoolCache.setMaxLimit(2);
    PoolCache.setMinLimit(1);
    PoolCache.setCacheScheme(OracleConnectionCacheImpl.DYNAMIC_SCHEME);
    *************************
    The problem is that even though i have defined the Max limit on the number of connections as 2, even if i run a loop 5 times, that makes connections, the connections are granted. I have ensured that the earlier connections are not closed. Could anyone point out the mistake i am making?
    TIA,
    abhishek.
  2. have you run getCacheSize while you're at a higher number of connections? I'd run that to understand how the cache is incrementing, etc.
  3. There are 3 different types of Cache schemes.
    DYNAMIC_SCHEME
    FIXED_RETURN_NULL_SCHEME
    FIXED_WAIT_SCHEME

    If you want just 2 connections, then you should use
    FIXED_RETURN_NULL_SCHEME as cache scheme.

    Hope this helps.

    Sudhakar.