public class JDBC_Pro extends HelloWorld {
//Database essential 
public String JDBC_Driver = "com.mysql.jdbc.Driver";
public String DB_Url = "JDBC:mysql://localhost:3306/kalinga";
public String USER = "root";
public String pass = "Welcome123";
public  Connection con = null ;
  public JDBC_Pro(){
     JDBC_Driver = "com.mysql.jdbc.Driver";
     DB_Url = "JDBC:mysql://localhost:3306/kalinga";
     USER = "root";
     pass = "Welcome123";
      try{
      Class.forName(JDBC_Driver);
        //System.out.println("Connecting to Database");
        con = DriverManager.getConnection(DB_Url, USER, pass);
        }
      catch(Exception e){System.out.println(e);
        }
  }
public void InsertData(String State,String City,String Age,String Dep,String Person,String Amount,String Des){
    try{
        String sql ="insert into kan values(?,?,?,?,?,?,?)";
        PreparedStatement pst = con.prepareStatement(sql);
        pst.setString(1,State);
        pst.setString(2, City);
        pst.setString(3, Age);
        pst.setString(4, Dep);
        pst.setString(5, Person);
        pst.setString(6, Amount);
        pst.setString(7, Des);
        int numRowsChanged = pst.executeUpdate();
        System.out.println(numRowsChanged);
        pst.close();
        con.close();
    }catch(Exception e){ e.printStackTrace();}
}
Abov is my JDBC file ... i want to call the Method InsertData() from my servlet file . When i run the JDBC file alone the the data is getting updated into the table but when i call this method from my servlet file like
JDBC_Pro b = new JDBC_Pro();
b.InsertData("the arguments goes here..");
Exception
java.lang.ClassNotFoundException: com.mysql.jdbc.Driverjava.lang.NullPointerException
both files are in same package! Can anyone please solve this problem