JDBC 2.0 DataSource deployment and connection pool configuration for Borland Application Server 4.5.1

Installing the i-net OPTA JDBC Driver

  1. Select Wizards→J2EE Deployment Wizard to install the i-net OPTA database driver.
    wizards.jpg
  2. Add the Opta.jar file to the list.
    add_opta.jpg
  3. Click Next and again Next. The next window should look like this.
    processing_opta.jpg
  4. Click Next. Add the server you want to install the driver on.
    libraries_opta.jpg
  5. Click Next. If everything is fine it should look like this:
    deploy_opta.jpg
  6. Click Finish. Now you have installed the i-net Opta database driver.

Using the Deployment Descriptor Editor (DDEditor) to create and edit DataSources

  1. Simply select Tools → Deployment Description Editor (DDEditor).
    tools.jpg
  2. Now select New → New Descriptor → New JNDI Definitions Descriptor to create a JNDI Definitions Descriptor
    create_jndi_descriptor.jpg
  3. Right Click the jndi-definitions.xml folder to pop up a choice list. Select “New Driver Datasource…” to create a Driver Datasource.
    create_driver_datasource.jpg
  4. Enter the name of the new Driver Datasource. Attention! Be sure you have set the name correctly. The name must be like this 'serial://datasources/<name>'. If it is not like this, you will get an exception later. Right Click the jndi-definitions.xml folder again. Select “New VisiTransact Datasource…” to create a VisiTransact Datasource.
    create_visitransact_datasource.jpg
  5. Enter the JNDI Name. Subsequently when you choose the created datasource, a panel will open allowing you to specify properties for it.

Driver DataSources

  1. Select the Driver Datasource you have created. In the “Main” tab you can enter the DataSourceClassName you want to use. 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.
    driver_main.jpg
  2. On the “Properties” tab you can enter some properties you need to set. Don't add additional properties!
    driver_properties.jpg
  3. Select the VisiTransact DataSource you have created. In the “Main” tab you can enter the Driver DataSource. Simply click on the right button of the combo box and select the Driver DataSource you have created before.
    visitransact_main.jpg
  4. Select the “Properties” tab and set the ConnectionType to XA.
    visitransact_properties.jpg
  5. You should then choose “Save” from the “File” menu and the XML descriptor will be persisted in the appropriate jndi-definitions.xml XML file. This descriptor file can now act as input to the Console's J2EE Deployment Wizard.

If you want to make the JNDI Definitions an integral part of your application archive then it is recommended that the descriptor be added to the EAR archive under META-INF/jndi-definitions.xml.

Using the Console to deploy DataSources to JNDI

After saving the XML file or EAR archive, use the J2EE Deployment Wizard to deploy the datasources. The Wizard reads the datasource properties from the jndi-definitions.xml descriptor file, instantiates the datasource objects–VisiTransact and driver vendor – and deploys all of them into the JNDI service.

  1. Select Wizards → J2EE Deployment Wizard to deploy the DataSources to JNDI.
    wizards.jpg
  2. Add the jndi-definitions.xml file to the list.
    add_jndi.jpg
  3. Click Next and again Next. In this window you see if the processing of the jndi-definitions.ml file was successful.
    processing.jpg
  4. Click on Next. On the next window select “Deploy jndi objects to the Name Service”.

deploy_jndi.jpg

  1. Click Next. If everything is ok, you get such a window.
    deploy_end.jpg
  2. Click Finish to end this process.

If you make mistages in the installation than you get some exceptions in this window. I show you some exceptions and what can be the problems.

ClassNotFoundExceptionBe sure, you have install the Opta DatabaseDriver!
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Property type [Enumerated] not supportedYou have add some properties to the Driver Datasource on the Properties Tab.
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Could not construct property value object ofYou have not set all properties in the Driver Datasource Properties Tab!
java.lang.IllegalArgumentException: Only instances of org.omg.CORBA.Object can be boundYou have not set the name of the Datasource Driver correctly!

Deploying the XATds Sample

  1. First you have to compile the samplexaTDSTest which comes with the i-net Opta driver. After you compiled it successfully copy the samplexa*.class files into an empty directory.
  2. Now open the Deployment Descriptor Editor. Select File → New → New Archive → New EJB JAR\new_ejb_jar.jpg
  3. Enter the EJB JAR Display Name to 'XATdsSample'
    jar_display_name.jpg
  4. Now click on Manage Contents… in this tab. You will see the Archive Tool
    archive_tool.jpg
  5. Select Actions → Add Files… Enter the directory in that you have copied the XATds Class Files.
    add_files.jpg
  6. Now you will have the files listed in the Archive Tool like that.
    archive_files.jpg
  1. Close the Archive Tool. Select File → New → 'New Session Bean' and enter the name of your bean. Now click on your bean in the tree. Change the Transaction Type to 'Bean' and the Session Type to 'Stateful'. Click on the buttons next to the edit fields and select the Home Interface, Remote Interface and the Bean Class. Enter in the JNDI Name field 'XATdsTest'
    bean_main.jpg
  2. Click on the 'Resource References' tab and click on 'Add'. Enter 'jdbc/TdsSample'. Select it and enter into the 'JNDI Name' field 'serial://datasources/jdbc/XATransaction'.
    resource_references.jpg
  3. Save it! Now select Verify → 'Set Class Path…' and enter this jar file. Select Verify → Verify. If all is correct and well done you get no warning or error. Close the Deployment Descriptor Editor.
  4. Select Wizards→J2EE Deployment Wizard. Add your saved JAR file and click Next and Next again. There should be no errors.
    jar_processing.jpg
  5. Click Next and click 'Add All Targets'.
    add_all_targets.jpg
  6. Click Next. Now you get the Deployment window and it should look like that.
  7. deploy_jar.jpg
  8. Click on Finish.

Testing the XATransaction with the XATds Sample

  1. Right click the deployed EJB JAR in the tree under 'EJB Containers' and select Generate Client Jar
    jar_menu.jpg
  2. Click Next. Enter the directory for the jar file and click Next.
    jar_directory.jpg
  3. If everything is fine you get this messages.
    client_generate_end.jpg
  4. Click Finish. Now you have created the jar file. Open a console and set all paths. Enter vbj -VBJclasspath <path of your client jar file> sample.xa.XATdsClient. Now you should see 'Test is finish'. That's all :-)

Known problems

java.sql.SQLException: This driver not include a Transaction Mananager.
                       at com.inet.tds.DTCDataSource.getConnection(Unknown Source)

You have lookup to DTCDataSource and not to the VisiTranscation DataSource.

Maybe the Borland Application Server has a problem with closing the connection from other threads when you opened the connection. Subsequently, you will get an exception.

 

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