InetSoft Technology: Database Connection Pooling

InetSoft's query engine uses connection pooling for enhanced database performance. The default size of the pool is five connections. For enterprise level deployment, the number of connections can be increased to a more appropriate size by setting the property jdbc.connection.pool.size in


Alternatively, an application can supply its own database connection pooling mechanism by implementing the ConnectionPool interface.


This method is called whenever a new connection is needed by the query engine. The pool should return the next available connection. If there are no more connections in the pool, this method should block until a connection is made available. The method syntax is as below

getConnection(XDataSource xds, Principal user); 

The parameter 'xds' denotes the jdbc data source. Parameter 'user' is a Principal object that identifies the user for whom the connection is being retrieved.


This method is called by the query engine after a connection is no longer needed. This method should be coordinated with the getConnection() method so that if there is a getConnection() pending, this method will notify the waiting thread.

data discovery example

Report Tool Demo Register

Read more about InetSoft's in-memory database technology to learn how it works and what its advantages are over a pure in-memory solution.

Example: Database Connection Pool

The following is a simple connection pool implementation. It creates ten connections at startup and manages the pool using a Stack.

import java.sql.*;
import java.util.*;
import inetsoft.uql.*;
import inetsoft.uql.jdbc.*;
public class SimpleConnectionPool implements ConnectionPool {
public SimpleConnectionPool() {
try {
} catch(ClassNotFoundException classx) {
String url = "jdbc:odbc:dxExample";
connections = new Stack();
for(int i = 0; i < size; i++) {
try {
Connection connection =
DriverManager.getConnection(url, "", "");
} catch(SQLException sqlx) {
public Connection getConnection(XDataSource xds, Principal user) {
Connection conn = null;
if(xds.getName().equals("Order")) {
synchronized(connections) {
while(connections.empty()) {
try {
} catch(InterruptedException interruptedx) {
conn = (Connection) connections.pop();
return conn;
public void releaseConnection(XDataSource xds, Connection conn) {
synchronized(connections) {
Stack connections;
int size = 10;

Setting the Connection Pool

There are two methods for setting the connection pool. The first method is to set the property jdbc.connection.pool in


The second method is to programmatically call JDBC.setConnectionPool().

ConnectionPool pool = new SimpleConnectionPool(); 

Note that it is important to call the close() function of a JDBCTableNode after using it, because if the system is busy it may cause a deadlock in the connection pool.