Use of a *-ds.xml file automatically includes JDBC connection pooling via JBossJCA. Your all set.
I am using a *-ds.xml, so that is good, but I still don't think my pooling is working. I am stress testing my webapp. Just for kicks, I set my Postgres server to only accept a maximum of 20 connections.
I created a stress test to have 50 concurrent users. After the test gets running, I get an error:
Could not create connection; - nested throwable: (org.postgresql.util.PSQLException: FATAL: sorry, too many clients already)
Shouldn't the connection pool start to queue these connections instead of throwing an exception?
Not if you do have 50 concurrent users. The connection is only returned to the pool when you close it. This obviuosly means it is not used anymore.
Connection pooling will not give you any kind of multiplexing of database access. This is not possible due to the fact that database transactions are bound to a certein connection.