ConcourseSuite Support

Support
Corporate
PUBLIC PROFILE

getConnection()

The methods getConnection(), freeConnection(), and renewConnection() all work together to provide the Action Class with interaction with the database connection pool.

The following code shows example usage of getConnection() and freeConnection() from an Action Class:

Connection db = null;
try {
  // Get a database connection from the pool
  db = getConnection(context);
  // Perform lots of work with the connection
} catch (Exception e) {
  context.getRequest().setAttribute("Error", e);
  return ("SystemError");
} finally {
  // Return the database connection to the pool
  this.freeConnection(context, db);
}

ConcourseSuite CRM has default properties in "build.properties" that specifies the maximum amount of time that a connection can be retained.

CONNECTION_POOL.MAX_DEAD_TIME.SECONDS=300

If the connection is not renewed with renewConnection(db) then the connection will be assumed to be misused and destroyed after the time limit has expired.

Since some operations in ConcourseSuite CRM may require a lengthy database connection, the connection can be renewed often to prevent recycling.

Sign in to add your comment.