Install the XADataSource sample in the Java 2 Enterprise Manager (J2EE) version 1.2

  • Copy the driver archive into the directory $J2EE_HOME/lib/system.
  • Add the driver archive Opta.jar to the classpath of the J2EE. The classpath of the J2EE is set with the environment variable J2EE_CLASSPATH and not with CLASSPATH.
  • Add the following lines to your config file default.properties:
    jdbc20.datasources=jdbc/TdsSample|jdbc/XATdsSample
    xadatasource.0.jndiname=jdbc/XATdsSample
    xadatasource.0.classname=com.inet.tds.DTCDataSource
    xadatasource.0.dbuser=sa
    xadatasource.0.dbpassword=
    xadatasource.0.prop.databaseName=YourDatabase
    xadatasource.0.prop.serverName=YourSQLServerHost

    *** 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.

  • Replace YourDatabase with a database of your SQL Server (for example the default database master)
  • Replace YourSQLServerHost with the name of your SQL Server.
  • Compile the sample in the package sample.xa.
  • Start the J2EE (or restart).
  • In the file “system.err” you can find the following two lines if everything has been configured correctly:
    Binding DataSource, name = jdbc/TdsSample, url = jdbc/XATdsSample
    Binding DataSource, name = jdbc/XATdsSample, dataSource = 
    com.inet.tds.DTCDataSource@29327a91;{database=YourDatabase, host=localhost, sql7=true}
  • Start the deployment tool of the J2EE (for example with deploytool.bat).
  • Click on “New Application”
  • Enter “XASample.ear” and “XASample” in the dialog box. You can use another name, also.
  • Select XASample in the tree and click on “New Enterprise Bean”.
  • Add the class files XATds.class, XATdsEJB.class and XATdsHome.class to the Contents with package.
  • Edit the JAR Display Name to “XASampleJar”. You can also use another name. You see the following picture.
    ejbjar1.jpg
  • In the next step select the class and interfaces. You see the next picture:
    ejbjar2.jpg
  • In the next steps add the account information for the bean like:
    ejbjar3.jpg
  • Click finish. You see the following picture:
    deploytool.jpg
  • Deploy the Application over the menue item “Tools | Deploy Application”.
  • Select the checkbox “Return Client Jar”. You see the next picture:
    deploy1.jpg
  • In the next step enter the JNDI name “XATdsTest”. This is the name that the client calls. You can it find in the script XATdsClient.java.
    deploy2.jpg
  • Now you can start the client with: java -cp .;XASampleClient.jar;j2ee.jar sample.xa.XATdsClient
 

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