Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connection Pool Leaving Connections Open

user12296100Jun 26 2015 — edited Jun 29 2015
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production0
PL/SQL Release 12.1.0.2.0 - Production0
CORE12.1.0.2.0Production0
TNS for Linux: Version 12.1.0.2.0 - Production0
NLSRTL Version 12.1.0.2.0 - Production0

Using JavaSE-1.7

Using ucp.jar,ons.jar and OJDBC7.jar

I have the following:

public class ucpDataSource

PoolDataSource pds;

private ucpDataSource() {

  pds = PoolDataSourceFactory.getPoolDataSource();

  pds.setConnectionFactoryClassName(factoryClassName);

  pds.setMaxPoolSize(maxPoolSize);  10

  pds.setMinPoolSize(minPoolLimit);     1

  pds.setMaxIdleTime(idleMaxTime);    50

  pds.setMaxConnectionReuseTime(connectionReUseTime); 5

  pds.setConnectionWaitTimeout(waitTimeOut); 100

  pds.setAbandonedConnectionTimeout(abandonedConnectionTimeout); 10

  pds.setInactiveConnectionTimeout(inactivityTimeout);30

  pds.setTimeToLiveConnectionTimeout(timeToLiveConnection); 30

  pds.setTimeoutCheckInterval(30);

}

public Connection getConnection() throws SQLException {

  return   pds.getConnection();

  }

public void CloseConn() {

  try {

  pds.getConnection().close();

  } catch (Exception e) {

  }

  }

In the calling body. I getConnection, CloseConn. I close the Connection in the class as well as any statements result sets etc.Please see attached .

The problem is that connections aren't being closed and the those connections are remaining active on the database. How do I prevent these connections from remaining active?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2015
Added on Jun 26 2015
10 comments
3,225 views