JDBC 2.0 DataSource deployment and connection pool configuration for Borland Application Server 4.5.1
Installing the i-net OPTA JDBC Driver
Select Wizards→J2EE Deployment Wizard to install the i-net OPTA database driver.
Add the Opta.jar file to the list.
Click Next and again Next. The next window should look like this.
Click Next. Add the server you want to install the driver on.
Click Next. If everything is fine it should look like this:
Click Finish. Now you have installed the i-net Opta database driver.
Using the Deployment Descriptor Editor (DDEditor) to create and edit DataSources
Simply select Tools → Deployment Description Editor (DDEditor).
Now select New → New Descriptor → New JNDI Definitions Descriptor to create a JNDI Definitions Descriptor
Right Click the jndi-definitions.xml folder to pop up a choice list. Select “New Driver Datasource…” to create a Driver Datasource.
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.
Enter the JNDI Name. Subsequently when you choose the created datasource, a panel will open allowing you to specify properties for it.
Driver DataSources
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.
On the “Properties” tab you can enter some properties you need to set. Don't add additional properties!
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.
Select the “Properties” tab and set the ConnectionType to XA.
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.
Select Wizards → J2EE Deployment Wizard to deploy the DataSources to JNDI.
Add the jndi-definitions.xml file to the list.
Click Next and again Next. In this window you see if the processing of the jndi-definitions.ml file was successful.
Click on Next. On the next window select “Deploy jndi objects to the Name Service”.
Click Next. If everything is ok, you get such a window.
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.
ClassNotFoundException | Be sure, you have install the Opta DatabaseDriver! |
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Property type [Enumerated] not supported | You have add some properties to the Driver Datasource on the Properties Tab. |
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Could not construct property value object of | You have not set all properties in the Driver Datasource Properties Tab! |
java.lang.IllegalArgumentException: Only instances of org.omg.CORBA.Object can be bound | You have not set the name of the Datasource Driver correctly! |
Deploying the XATds Sample
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.
Now open the Deployment Descriptor Editor. Select File → New → New Archive → New EJB JAR\
Enter the EJB JAR Display Name to 'XATdsSample'
Now click on Manage Contents… in this tab. You will see the Archive Tool
Select Actions → Add Files… Enter the directory in that you have copied the XATds Class Files.
Now you will have the files listed in the Archive Tool like that.
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'
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'.
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.
Select Wizards→J2EE Deployment Wizard. Add your saved JAR file and click Next and Next again. There should be no errors.
Click Next and click 'Add All Targets'.
Click Next. Now you get the Deployment window and it should look like that.
-
Click on Finish.
Testing the XATransaction with the XATds Sample
Right click the deployed EJB JAR in the tree under 'EJB Containers' and select Generate Client Jar
Click Next. Enter the directory for the jar file and click Next.
If everything is fine you get this messages.
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.