title: i need the help for connecting mysql with java in ubuntu OS
body: <p>I have my java application and try to connect with mysql database.But i can't able to get the output,i am getting the Exception error.I think i am not able to connect with the driver.My OS is Linux(Ubuntu).</p>
  
  <hr>
  
  <pre><code>nikki@nikki-laptop:~$ java -version
  java version "1.6.0_20"
  OpenJDK Runtime Environment (IcedTea6 1.9) (6b20-1.9-0ubuntu1)
  OpenJDK Client VM (build 17.0-b16, mixed mode, sharing)
  
  nikki@nikki-laptop:~$ echo $JAVA_HOME
  /usr/java/jdk1.6.0_20/bin/java
  
  
  nikki@nikki-laptop:~$ echo $CLASSPATH
  .:/usr/share/java/mysql.jar:/home/nikki/temp/src/jclass
  </code></pre>
  
  <hr>
  
  <p>My jdk path is   /usr/lib/jvm/java-1.6.0-openjdk/jre</p>
  
  <hr>
  
  <p>My Java program is</p>
  
  <pre><code>import java.sql.*;
  class Query1
   {
   public static void main(String args[])throws Exception
   {
   try
   {  // the mysql driver string
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    // the mysql url = "jdbc:mysql://THE_HOST/THE_DATABASE";
  
    //String url = "sun.jdbc.odbc.JdbcOdbcDriver";
  
    String url ="jdbc:mysql://localhost/mylib_db";
  
    Connection conn = DriverManager.getConnection(url,"nikki","dkm007");
   Statement stmt = conn.createStatement();
   //ResultSet rs;
   ResultSet rs = stmt.executeQuery("select title from Book_dim where cost=435.89");
   while (rs.next())
   {
   String titlename = rs.getString("title");
   System.out.println(titlename + "\n");
   }
    conn.close();
  
   }
    catch(Exception e)
    {
    System.err.println("Got an exception! ");
                  System.err.println(e.getMessage());
    }
   }
   }
  </code></pre>
  
  <hr>
  
  <p>My output is</p>
  
  <pre><code>-    -      -      -             -
  nikki@nikki-laptop:~/Documents/Chinu/mydbP$ javac Query1.java
  nikki@nikki-laptop:~/Documents/Chinu/mydbP$ java Query1
  Got an exception! 
  com.mysql.jdbc.Driver
  </code></pre>
  
  <hr>
  
  <p>I didn't added any driver...i don't know which Driver should i use .How can i add driver?
  If possible plz send me the reply.</p>