How JDBC applications connect to a data source

Before you can execute SQL statements in any SQL program, you must be connected to a data source.

The IBM® Data Server Driver for JDBC and SQLJ supports type 2 and type 4 connectivity. Connections to Db2 databases can use type 2 or type 4 connectivity. Connections to IBM Informix® databases can use type 4 connectivity.

The following figure shows how a Java application connects to a data source using IBM Data Server Driver for JDBC and SQLJ type 2 connectivity. JDBC method calls in the Java application are sent to the driver. The driver converts JDBC calls into native calls for the local data source. Remote calls are passed to the remote data source.

Figure 1. Java application flow for IBM Data Server Driver for JDBC and SQLJ type 2 connectivity
Java application flow for a type 2 driver

The following figure shows how a Java application connects to a data source using IBM Data Server Driver for JDBC and SQLJ type 4 connectivity. JDBC method calls in the Java application are sent to the driver. The driver converts JDBC calls into the network protocol for the data source.

Figure 2. Java application flow for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity
Java application flow for a type 4 driver