8 Replies Latest reply: Apr 9, 2009 12:09 PM by 798635 RSS

    jdbc connection to mysql

    843789
      hi all,
      i write jdbc connection program here
      import java.sql.*;
      
      public class connection1{
        public static void main(String[] args) {
          System.out.println("MySQL Connect Example.");
          Connection conn = null;
          String url = "jdbc:mysql://192.168.1.6:8001/";
          String dbName = "pms";
          String driver = "com.mysql.jdbc.Driver";
          String userName = "pmsmgr"; 
          String password = "pmsmgr";
          try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url+dbName,userName,password);
            System.out.println("Connected to the database");
            conn.close();
            System.out.println("Disconnected from database");
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      } 
      
      
      but output comes like
      class not found exception: com.mysql.jdbc.Driver
      please tell how to set path for jdbc connection to my sql..
      mysql server i stored in my local E drive.. plz help me
      
      regards 
      balakrishna