JDBC drivers today are classified into four categories:
- Type 1: Drivers accessing a database through a different technology (known as Bridge). The JDBC-ODBC bridge, allowing connection via an ODBC driver are the most common example. The driver converts the data calls in Java in valid ODBC ones, and then executes them using the ODBC driver
- Type 2: Native API drives. They consist of native and Java drivers. JDBC calls are translated into native calls for the database server (Oracle, Sybase, and others), generally in C or C + +.
- Type 3: Drivers that converts JDBC calls into a DBMS-independent protocol. A server then converts them into the required DBMS (3-layer model) protocol.
- Type 4 drivers: Drivers that converts the JDBC calls directly into a network protocol used by the DBMS. These drivers directly encapsulate the DBMS client interface and are supplied by the publisher database. This solution is efficient within an intranet.
Currently, most of the databases present on the market possess an ODBC driver (many of them have been developed based on interfaces from Microsoft).
ODBC stands for Open Database Connectivity. It is a proprietary format developed by Microsoft that enables communication between databases clients running on Windows and DBMS available on the market.
Since there are different types of databases, and each of them has its own way of dealing with SQL queries and to return the results, ODBC provides identical results regardless of the type of database, without the need for you to configure the program that sends the request.
Note that: ODBC is not a free technology (Microsoft makes it evolve on its own) and on the other hand it is alternative to the interface provided by the database manufacturers.
The JDBC-ODBC bridge
To illustrate the connection to a database, we will connect to an Access database through the ODBC-JDBC bridge, addressing all stages required for the connection to a database.
After creating the database in Access, you must initially incorporate base in ODBC Control Panel > ODBC data source. The steps for creating the ODBC source are:
- Select the driver for the database in question (in our case Microsoft Access Driver)
- Define the database name and path
- set the name of the data source and the password
Original document published on CommentcaMarche.net.