Home Jdbc JDBC Drive For Mysql



JDBC Drive For Mysql
Posted on: November 17, 2008 at 12:00 AM
In this Tutorial we want to describe you a code that help you in understanding JDBC Drive for Mysql.

JDBC Drive For Mysql

     

In this Tutorial we want to describe you a code that help you in understanding JDBC Drive for Mysql. The code include a class JdbDriveForMysql,Inside the main method we declared a string driver initialized  with "com.mysql.jdbc.Driver".The try block include the following steps-

Driver loading: loading a driver is the first step by calling a class.forname( ) and passed driver class as argument. Once the driver is loaded ,you connect the front end of the Java application to the backend database. In case there will be an exception occurred  in loading a database driver  in the try block. The catch block check the exception and println print the exception.

Finally the println print the value of  jdbc driver for mysql is specified in string driver. 

JdbcDriveForMysql .java


public class JdbcDriveForMysql {
  public static void main(String args[]) {
  String driver = "com.mysql.jdbc.Driver";
  try {
  Class.forName(driver);
  System.out.println("jdbc driver for mysql : " + driver);
  catch (Exception e) {
  System.out.println(e);
  }
  }
}

Output

jdbc driver for mysql : com.mysql.jdbc.Driver

Download code

Related Tags for JDBC Drive For Mysql:
sqlmysqlcantjdbchelptutorialriathisfortodriveedesinstamntwanjdbcdbesjdbdescribetorsatmyishaivandcodcodeunderstandingwanttutorscrssrithbcsthatndodeo


More Tutorials from this section

Ask Questions?    Discuss: JDBC Drive For Mysql   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.