Hi,

I am sending this mail again as no one has answered my previous mail, I am
restating the problem I am facing and also have attached a sample to
recreate the problem.

I have a stateless session EJB which accesses a DB2 datasource created using
the tranql generic connector. This uses the container managed transaction. I
am also using the DB2 9.1 universal JDBC drivers. For methods dealing with
datasource related operations I have set sessionContext.setRollBackOnly()
within the catch block of SQLException.This throws exceptions when there
have to be rollbacks at the database level. For example trying to insert a
duplicate record throws the following exception:-
com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10114][10307] Invalid
operation: Explicit COMMIT or ROLLBACK is not allowed when in auto-commit
mode. I have created an example to illustrate this and have attached the
source with this mail.

I think this is something related to Tranql. Is there any way to turn auto
commit off? Can anyone please suggest a way around this? I have stuck with
this for some time now.

Thanks and regards,

Vimalan

Attachment: SessionTestBean.java
Description: Binary data

Attachment: SessionTestClient.java
Description: Binary data

Attachment: SessionTestRemote.java
Description: Binary data

Attachment: SessionTestRemoteHome.java
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>

<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1";>
	<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1";>
		<dep:moduleId>
			<dep:groupId>Test</dep:groupId>
			<dep:artifactId>Test</dep:artifactId>
			<dep:version>1.0</dep:version>
			<dep:type>car</dep:type>
		</dep:moduleId>
		<dep:dependencies>
                      <dep:dependency>
                          <groupId>jdbc</groupId>
                          <artifactId>Test</artifactId>
                          <dep:version>1.0</dep:version>
                  	  <dep:type>car</dep:type>
                      </dep:dependency>
                </dep:dependencies>
		<dep:hidden-classes/>
		<dep:non-overridable-classes/>
	</dep:environment>

 

    <enterprise-beans>
        <session>
            <ejb-name>SessionTestBean</ejb-name>
            <jndi-name>SessionTestBean</jndi-name>
            <resource-ref>
               <ref-name>testDataSource</ref-name>
               <resource-link>jdbc/Test</resource-link>
            </resource-ref>
        </session>
    </enterprise-beans>
</openejb-jar>
 
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd";>


<ejb-jar>

	<display-name>Test</display-name>

	<enterprise-beans>
		<session>
			<description><![CDATA[stateless test session bean]]></description>
			<ejb-name>SessionTestBean</ejb-name>
			<home>com.test.ejb.SessionTestRemoteHome</home>
			<remote>com.test.ejb.SessionTestRemote</remote>
			<ejb-class>com.test.ejb.SessionTestBean</ejb-class>
			<session-type>Stateless</session-type>
			<transaction-type>Container</transaction-type>

                         <resource-ref>
                            <res-ref-name>testDataSource</res-ref-name>
                            <res-type>javax.sql.DataSource</res-type>
                            <res-auth>Container</res-auth>
                            <res-sharing-scope>Shareable</res-sharing-scope>
                         </resource-ref>			

		</session>

	</enterprise-beans>

	<assembly-descriptor>

		<method-permission>
			<description><![CDATA[Method permission description]]></description>
			<unchecked/>
			<method>
				<description><![CDATA[Method permission for Session Test Bean]]></description>
				<ejb-name>SessionTestBean</ejb-name>
				<method-name>*</method-name>
			</method>
		</method-permission>
		
               <container-transaction>
                  <method>
                     <ejb-name>SessionTestBean</ejb-name>
                      <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
                </container-transaction>

	</assembly-descriptor>


</ejb-jar>

Reply via email to