2 Replies Latest reply on Mar 29, 2005 11:42 PM by Sriram Padmanabhan

    Connection Pooling In JBOSS

    Sriram Padmanabhan Newbie

      I am Using oracle as the datasource. I have a doubt whether I should write any connection pool for the JBoss app Server.Lets Say I have a maximum of
      15 connections configured in my oracle-xa-da.xml. I have pasted my oracle-xa-ds below.

      <xa-datasource-property name="URL">jdbc:oracle:oci8:@tc</xa-datasource-property>
      <xa-datasource-property name="User">scott</xa-datasource-property>
      <xa-datasource-property name="Password">tiger</xa-datasource-property>
      <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
      <!-- Checks the Oracle error codes and messages for fatal errors -->
      <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->

      <!-- The maximum connections in a pool/sub-pool -->

      <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->

      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager

      I have written a connection pool class as shown below.

      import java.sql.*;
      import javax.sql.*;
      import javax.naming.*;

      public class DBConnector {
      public Connection getConnection(){

      try {

      Context ctx = new InitialContext();

      DataSource ds = (DataSource) ctx.lookup("java:/DevelopmentDS");

      return ds.getConnection();

      }catch(Exception exe){

      System.out.println ("The exception is " + exe);

      return null;



      public void closeConnection (PreparedStatement stmt, ResultSet rs, Connection con){


      if (stmt != null){



      if (rs != null){



      if (con != null){



      }catch(Exception exe){




      If 25 different Session Beans tries to get the connection from the pool
      what will happen, will JBoss internally Queue the Bean until they get a connection. Please help me