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.
![Java application flow for a type 2 driver](../art/sqlajt2d.gif)
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.
![Java application flow for a type 4 driver](../art/sqlajt4d.gif)