Creating connection objects in SQLJ applications
To establish a connection to the database, we use connection contexts in the SQLJ application. A connection context specifies the database details, transaction behavior, and session to be used in the application. In this recipe, we will focus on the different ways of establishing database connections in SQLJ applications.
Getting ready
DB2 supports IBM Data Server Driver for JDBC and SQLJ for SQLJ applications. This driver is packaged as db2jcc.jar
and sqlj.zip
for JDBC 3.0 and as db2jcc4.jar
and sqlj4.zip
for JDBC 4.0. This driver allows us to use type-2 and type-4 type connectivity.
This driver is shipped with DB2.
How to do it...
The basic idea with all these techniques is to create a connection ...
Get IBM DB2 9.7 Advanced Application Developer Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.