First thing to develop the JDBC program is to download the JDBC Driver for the database you are using to connect to your program. In our case we are using the MySQL database, so we have download the JDBC Driver for the MySQL.
The website mysql.com is distributing the free version of the JDBC driver for the MySQL database which can be downloaded from visiting the website.
There three packages of the JDBC driver:
- Window package
- Zip package
- Tar package
In most of the cases zip package is fine and you can use it in windows as well as on the Linux system.
So, just download the Zip package.
Visit the website http://dev.mysql.com/downloads/connector/j/ and you will find the link for downloading the JDBC Driver.
This database driver is JDBC Type 4 database driver, which directly connects to the default (specified) port of the MySQL database using the TCIP.
This MySQL database driver is JDBC 3.0 and JDBC 4.0 specifications compliant and it also provides the compatibility with all the functionality of MySQL, including 4.1, 5.0, 5.1, 5.5, 5.6, and 5.7. Connector/J 5.1.
Video recording of the process of downloading the JDBC Driver for MySQL
After extracting the zip package you will find some directories, doc files, read me file and a mysql-connector-java-xxxx-bin.jar file.
This jar file is the compiled packaged JDBC driver for connecting the Java program to the MySQL Database.
This database driver is mature and provides the features like auto-registration with the Driver Manager, standardized validity checks, categorized SQLExceptions, and support for the JDBC-4.0 XML processing.
It also supports the data types like NCHAR, NVARCHAR and NCLOB.
You can simply copy the jar file into your project and include it in the build path. That's it and you application will be ready to talk to the MySQL database server.
We have 100s of tutorial of JDBC Programming at http://www.roseindia.net/jdbc/index.shtml. Visit this page to learn JDBC programming through articles and many example programs.