0

Is there a way to Disable the JBoss Datasource connection pooling?

I am using PgPool to loadbalance several PostgresDB instances via a standard JDBC connection. As this physically Open's & Close's DB, there's a good distribution of the select requests and works well..

However, When I get a connection from the JBoss JNDI datasource, it issues an existing connection which is maintained by the pool. The problem with this is: It tends to always give me the same DBs which were maintained by the underlying socket connection, hence the distribution of requests are not that great.

DataSource datasource = (DataSource)initialContext.lookup(DS_Context);
conn = datasource.getConnection();
//do stuff like "select * from.." with conn.
conn.close();

The above statement would connect frequently to the same database as the JNDI pool maintains a steady open socket to the database. Is there a way to disable pooling, while still maintaining JNDI Datasource in JBoss?

Shawn
  • 2,679
  • 2
  • 15
  • 26

1 Answers1

0

Try setting data-source max pool size to 1 in jboss configuration.

 <max-pool-size>1</max-pool-size>
Amila
  • 5,195
  • 1
  • 27
  • 46
  • 1 appears to have worked. When the number of connection requests increase, the distribution of the connections amongst the DB Slaves are fairly even.. I left the 50 – Shawn Aug 31 '16 at 09:39