-
Book Overview & Buying
-
Table Of Contents
IBM DB2 9.7 Advanced Application Developer Cookbook
By :
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.
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.
The basic idea with all these techniques is to create a connection context based on an interface that can identify the database. The database can be represented by a DataSource interface or a DriverManager interface. We use these interfaces as arguments for the context class constructor method.
1. Technique 1 : This...
Change the font size
Change margin width
Change background colour