In a computer system, an adaptor program is required for making a connection to another system of different type. Similar to connecting a printer to a computer by using a printer driver, a DBMS (database management system) needs a database driver that enables a database connection in other systems.
A database driver is a computer program that implements a protocol (ODBC or JDBC) for a database connection.
The driver works like an adaptor which connects a generic interface to a specific database vendor implementation. To make a database connection in a Java application, we need a
JDBC (Java Database Connectivity API) driver. To connect with individual databases, JDBC requires drivers for each specific database type.
For instance, if a Java application requires a connection to data source from MySQL database, we need to include the library
MySQL JDBC Driver which is a Jar file, namely
mysql-connector-java-5.1.23-bin.jar. The version number in the Jar file can be different. The name of the driver is
In the NetBeans IDE, in a Java application project, the MySQL JDBC Driver can be imported by right-click the node
Libraries in the
Projects tab window.
Next, if you want to know how to use interfaces in a JDBC driver to access a database in a Java application, you may continue to read Accessing Databases with JDBC.