1 Reply Latest reply on Aug 6, 2009 11:39 AM by Jon Powell

    UNmanaged JBoss Connection Pool wanted!

    Jon Powell Newbie

      Hi,

      I am struggling to put an "unmanaged" (in CMP terms) alongside a managed datasource in our JBoss 4.2.2GA, (Hibernate) SEAM 2.1 application. I want to do plain vanilla JDBC without interference from the JBoss connection manager and will take responsbility for managing/closing logical connections retrieved from the JNDI pool. The tables handled by each datasource will be isolated and should not interfere with each other, even though they are on the same database.

      The DS configuration is as follows:

       <local-tx-datasource>
       <jndi-name>ds1</jndi-name>
       <connection-url>jdbc:oracle:thin:@X.Y.Z.T:port:sid</connection-url>
       <driver-class>oracle.jdbc.OracleDriver</driver-class>
       <user-name>user</user-name>
       <password>pass</password>
       </local-tx-datasource>
      
       <no-tx-datasource>
       <jndi-name>jdbc/ds2</jndi-name>
       <use-java-context>false</use-java-context>
       <connection-url>jdbc:oracle:thin:@X.Y.Z.T:port:sid</connection-url>
       <driver-class>oracle.jdbc.OracleDriver</driver-class>
       <user-name>user</user-name>
       <password>pass</password>
       </no-tx-datasource>
      


      I am perfectly content to let 'java:/ds1' be managed by SEAM & JBoss, but want to have complete control over 'jdbc/ds2'. In the console I can see ds2 being registered, I can start a JNDI context using 'jdbc/ds2', but get the following errors when trying to set autocommit or do a commit on a connection:

      For JBoss-managed connection pool, autoCommit not supported.
      
      OR
      
      Trouble committing transaction: java.sql.SQLException: You cannot commit during a managed transaction!
      


      Note that I have carefully wrapped the connection retrieved from the datasource so as to have access to the physical Oracle connection but only close the logical connection.

      :banghead: expresses it really well!

      Any help is much appreciated.

      Best regards,

      Jon

        • 1. Re: UNmanaged JBoss Connection Pool wanted!
          Jon Powell Newbie

          To add more:

          Yes, I have tried the typical SEAM annotations to signify to the container that I will handle transaction management via

          @TransactionManagement(TransactionManagementType.BEAN)
          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
          


          at both the calling action class level and down in the class that handles the alternate persistence scheme.

          Thanks again for any help!