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?
Try setting data-source max pool size to 1 in jboss configuration.
<max-pool-size>1</max-pool-size>