1 Reply Latest reply on Dec 13, 2001 12:30 PM by bdainton

    JBoss/Tomcat Design Issue

    bdainton

      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 =
      (javax.sql.DataSource) ctx.lookup("java:/Oracle_Mars_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">
      Oracle_Mars_DS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

      jdbc:oracle:thin:@mars.ourcompany.com:1521:holtqa
      true
      5000
      1200000
      userid
      10
      3
      password
      </mbean-->

      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.

      Regards,

      Brian

        • 1. Re: JBoss/Tomcat Design Issue
          bdainton

          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:

          <resource-ref>
          <res-ref-name>jdbc/datasourcename</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <jndi-name>java:/jndiName</jndi-nam>
          ....