-1
   import java.io.*;
   import java.sql.*;
   public class check
   {
      public static void main (String[] args)

    try
    {
         //String hi="com.mysql.jdbc.Driver";
         Class.forName("com.mysql.jdbc.Driver");
         System.out.println("class loaded");
         String oracleurl= "jdbc:mysql://localhost:3306/check";
         String username= "root";
         String password= "vihu";
         Connection conn = DriverManager.getConnection(oracleurl,username,password);
         Statement s = conn.createStatement();
        String query="create table login(username1 varchar(20),password1 varchar (25))";
         s.executeUpdate(query);
          System.out.println("Connection1 Established ");
         s.close();
          conn.close();
    }
    catch(Exception e)
    {
        System.out.println(e.toString());


    }
}

}

in this code i got error of "classNotFoundException:com.mysql.jdbc.driver" though i had mysql connector but when i run same type of code this error i didnt get kindly help me thanks in advance ..!!

vshah1
  • 57
  • 1
  • 11

1 Answers1

0

You have to put the connector class in your class path, If it is not there it will throw exception like these,Please search yourself first put some effort, otherwise you will not learn.

Narendra Jaggi
  • 1,297
  • 11
  • 33