Configuring EJB applications to use SQLJ instead of JDBC for enterprise bean persistence (workbench only)
You can use SQLJ instead of JDBC to make calls to a DB2 database when deploying 2.x CMP beans. SQLJ is a standard set of programming extensions, which allows the use of Java classes to define SQL types, which can then be used as columns in tables. It allows you to embed SQL database statements in a Java program.
To run the SQLJ-based enterprise beans in the WebSphere test environment, follow these instructions:
- Edit the server configuration, and add DB2_install/java/db2jcc.jar to the class path of the DB2 JDBC provider that you are using.
- Ensure that the data source is configured to use com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper as the data source helper class
- For DB2 Version 8, fix pack 2 and above, make sure you have the license file.
Follow these tasks in sequence to prepare your EJB applications to use SQLJ:
- Adding the SQLJ run-time JAR file to the class path
In preparation for running your application using SQLJ in your product's test environment and in WebSphere Application Server, add the SQLJ run-time JAR to the class path of the JDBC provider of the data source that is used by the EJB project. This does not replace any other DB2 JAR files on this class path.- Configuring your application to use SQLJ instead of JDBC
You can use SQLJ instead of JDBC to make calls to a DB2 database when deploying 2.x CMP beans. In order to do that, you have to configure your applications to use SQLJ.- Specifying a different location for the SQLJ translator and main class
Once you have used the view to configure your application to use SQLJ, the default values for the location of the SQLJ translator and main class appear in the Properties view. But, you can change their locations if you want to. You will need to do this if you have moved files around: you need to make sure the paths are correct.
Parent topic
Deploying EJB applications using SQLJ for data access
Previous topic: Requirements for deploying EJB applications using SQLJ
Next topic: Running the EJB deployment tool