Deploy SQLJ applications
Use SQLJ to develop data access applications that connect to DB2 databases.
SQLJ is a set of programming extensions that enable you to use the Java programming language to embed statements that provide SQL database requests.
With SQLJ we can:
- Improve performance by using static SQL statements.
- Write less code with the simpler SQLJ syntax.
- Detect programming errors earlier in the development phase with the onlinecheck function, which performs data type validation and schema validation.
Consider using SQLJ in situations where dynamic SQL is not needed, and where applications use DB2 as the database server.
New feature: The appserver includes enhanced SQLJ support for applications that use CMP. The new features include:
- Deploy CMP beans during the application installation in the appserver.
- Customize SQLJ profiles with the admin console or scripting.
- Customize SQLJ applications again without needing to reinstall the application.
These enhancements reduce the complexity of installing, deploying, and customizing SQLJ applications for both container-managed and bean-managed persistence
Procedure
- Acquire the required drivers to deploy an SQLJ application in the appserver.
JDBC provider type Required files DB2 using IBM JCC Driver:
- IBM Data Server Driver for JDBC and SQLJ
- IBM DB2 Driver for JDBC and SQLJ
- IBM DB2 Universal JDBC Driver.
db2jcc.jar or db2jcc4.jar DB2 Universal JDBC driver (deprecated) db2jcc.jar
- Deploy the SQLJ application.
- Deploy applications that use CMP:
- Deploy SQLJ applications that use CMP with the DB2 using IBM JCC Driver.
- Deploy SQLJ applications that use CMP with the ejbdeploy tool.
- Deploy SQLJ applications that use bean-managed persistence, servlets, or sessions beans.
- Use embedded SQLJ with the DB2 for z/OS Legacy driver (deprecated).
- Customize and bind the SQLJ profiles.
Before using SQLJ applications, the SQLJ statements must be pre-processed for the database server.
- Customize profiles for SQLJ applications.
- Customizing and binding SQLJ profiles with wsadmin.
- Customize SQLJ profiles with the db2sqljcustomize tool.
By default, four DB2 packages are created in the database; one package is created for each isolation level. The customization process augments the profiles with information that is specific to the database. If we do not customize the SQLJ profiles, the SQLJ application will use dynamic SQL like a JDBC application.
Deploy SQLJ applications that use CMP
Deploy SQLJ applications that use bean-managed persistence, servlets, or sessions beans
Customize profiles for SQLJ applications
Use embedded SQLJ with the DB2 for z/OS Legacy driver
Related tasks
Deploy SQLJ applications that use CMP with the ejbdeploy tool
Customize SQLJ profiles with the db2sqljcustomize tool
Rational Application Developer: Developing SQLJ applications
Related
Application management