I have a design related question regarding a deployment of Jboss-2.4.3 bundled with Tomcat 3.2.3.
The application is quite simple, thus my initial design did NOT include EJB's. Very simple selects, inserts and updates. The application is also going to have very light usage (a couple of users, only on Saturdays!).
I have a series of Struts-based JSP's which get their data from a series of helper classes.
The helper classes get a JDBC connection via:
javax.naming.Context ctx = new javax.naming.InitialContext();
// perform JDNI lookup to
//obtain database connection factory
System.out.println("connecting to oracle");
javax.sql.DataSource ds =
// Invoke factory to obtain a resource
Connection conn = ds.getConnection();
Within JBoss, the datasource has been setup as:
<!--mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=Oracle_Mars_DS">
As you can see above, the maximum connection is 10. After 10 simple select statements (originating from a servlet deployed on Tomcat), I run out of connections.
I was under the impression that doing a Connection.close() from a servlet, would close the connection and make it available to other within the pool.
I have a feeling that if I move all data access into an EJB, then all will be fine. What have others done in terms of non-EJB access from the web-tier.
I would appreciate any help or direction in this matter.
Connections are now being closed, and released to the pool. Sorry for the simple post. It helps to read the manual. I was not aware of jboss-web.xml
I added jboss-web.xml with a resource-ref that specified the datasource and jndi name: