This article discuss 'how to connect Java and MYSQL using MYSQL connector' in Java. The article will give you view on downloading and installing MYSQL Java connector library into your Java application folder.
MYSQL Java connector library is required to establish a connection in between your Java application and MYSQL database. Downloading Java SDK and MYSQL server is not sufficient to create a database application in Java. You will also required a MYSQL Java Connector Library for using MYSQL server in your application.
MYSQL Java Connector Library or MySQL Connector/J is a native Java driver, which is required to converts JDBC calls into the network protocol that is further used by the MySQL database. Basically, a MySQL Connector/J is the official JDBC driver for MySQL required for connecting Java and MYSQL Database Server. You can download your copy of MYSQL Java Connector Library from the MYSQL official website.
MYSQL Java Connector Library or Mysql JDBC connector is simply a Jar file that need to be copied in to your project folder. Given below are the few steps to help you setting the Mysql JDBC connector.
As you know that the JDBC driver doesn't required any installation. All you need to do is to provide the location of the file to the Java Command, whenever you starts your program. Java command is as given below:
java -cp myapp.jar;D:\classpath\mysql-connector-java-5.1.22-bin.jar MyMain
Or to add it inside your NetBeans or any other project, simply add the jar file in the "Libraries" section of your project.
Posted on: December 20, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles