JDBC driver

JDBC interfaces are declared in the JDK. They need a concrete class to implement them in order to be useful. These concrete classes come from the JDBC driver. Each database has a different JAR file with these classes. For example, MySql’s JAR is called something like mysql-connector-java-5.1.36.jar. The exact name depends on the version of the driver JAR.
This driver JAR contains an implementation of these key interfaces along with a number of others. The key is that the provided implementations know how to communicate with a database. 
```
import java.sql.*;
public class C {
    public static void main(String[] args) throws SQLException {
        String url = "jdbc:derby:zoo";
        try (Connection conn = DriverManager.getConnection(url); 
            Statement stmt = conn.createStatement(); 
            ResultSet rs = stmt.executeQuery("select name from animal")) {
            while (rs.next()) 
                System.out.println(rs.getString(1));
        }
    }
}
```
There are many possible implementations of JDBC drivers. These implementations are categorized as follows:
*    Type 1: Drivers that implement the JDBC API as a mapping to another data access API, such as ODBC (Open Database Connectivity). Drivers of this type are generally dependent on a native library, which limits their portability. The JDBC-ODBC Bridge is an example of a Type 1 driver.  Note: The JDBC-ODBC Bridge should be considered a transitional solution. It is not supported by Oracle. Consider using this only if your DBMS does not offer a Java-only JDBC driver.
*    Type 2: Drivers that are written partly in the Java programming language and partly in native code. These drivers use a native client library specific to the data source to which they connect. Again, because of the native code, their portability is limited. Oracle's OCI (Oracle Call Interface) client-side driver is an example of a Type 2 driver.
*    Type 3: Drivers that use a pure Java client and communicate with a middleware server using a database-independent protocol. The middleware server then communicates the client's requests to the data source.
*    Type 4: Drivers that are pure Java and implement the network protocol for a specific data source. The client connects directly to the data source.

Check which driver types comes with your DBMS. Java DB comes with two Type 4 drivers, an Embedded driver and a Network Client Driver. MySQL Connector/J is a Type 4 driver.