How to use i-net OPTA with BEA WebLogic Server 6.0 (You will need i-net OPTA v. 4.0 or higher)

  1. Copy the jar file Opta.jar to the Server.
  2. Add the Opta.jar file to the class path of the start script and restart the WebLogic Server.
  3. Start the console of the WebLogic Server with a  shortcut or in the browser with http://localhost:7001/console/index.jsp.
  4. Create a JDBC Connection pool like:
  5. Activate the pool in your target in the tab “Targets”.
  6. Create a Tx Data Source
  7. If you want use a classic transaction (Connection.commit(), ..) then you need to set the option SupportsLocalTransaction=“true” in the file config.xml. This look like
    <JDBCConnectionPool CapacityIncrement="1" DriverName="com.inet.tds.DTCDataSource"
                        InitialCapacity="1" MaxCapacity="2" Name="inetOptaXAPool"
                        Properties="user=sa;password=;dataSourceName=inetOptaXAPool;
                        databaseName=master;serverName=LocalHost"
     
                        SupportsLocalTransaction="true" Targets="examplesServer" />


    *** If you can't install the Resource Manager Proxy in the SQL Server then you can use com.inet.tds.XDataSource instead of com.inet.tds.DTCDataSource.

  8. Compile the sample in the package sample.xa.
  9. Create an ejb-jar.xml file with this context:
    <?php
    xml version="1.0" encoding="Cp1252"?>
    <!DOCTYPE ejb-jar
    PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
    'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
     
    <ejb-jar>
        <description>no description</description>
        <display-name>XASampleJar</display-name>
        <enterprise-beans>
            <session>
                <description>no description</description>
                <display-name>Enterprise Bean</display-name>
                <ejb-name>Enterprise Bean</ejb-name>
                <home>sample.xa.XATdsHome</home>
                <remote>sample.xa.XATds</remote>
                <ejb-class>sample.xa.XATdsEJB</ejb-class>
                <session-type>Stateful</session-type>
                <transaction-type>Bean</transaction-type>
                <resource-ref>
                    <res-ref-name>jdbc/TdsSample</res-ref-name>
                    <res-type>javax.sql.DataSource</res-type>
                    <res-auth>Container</res-auth>
                </resource-ref>
            </session>
        </enterprise-beans>
    </ejb-jar>
  10. Create a jar with jar -cf XaSample.jar sample.xa.XATdsHome sample.xa.XATds sample.xa.XATdsEJB meta-infejb-jar.xml
  11. Click on “install new EJB” and upload the file XaSample.jar
  12. Now you can start the client with: java -cp .;XASampleClient.jar;j2ee.jar sample/xa/XATdsClient

Known problems

  • With Version 6.0 and 6.0 Sp1 the WebLogic Server close all Statements and ResultSet on a commit of a UserTransaction. This is a limit with all XaDataSources

     
  • Error Message: SQL operations are not allowed with no global transaction by default for XA drivers. If the XA driver supports performing SQL operations with no global transaction, explicitly allow it by setting “SupportsLocalTransaction” JDBC connection pool property to true. In this case, a lso remember to complete the local transaction before using the connection again for global transaction, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set auto commit to true or call Connection. See step 7.
 

© Copyright 1996 - 2024, i-net software; All Rights Reserved.