I have started working with jdbc on UBUNTU. I have set classpath for jar file. I successfully executed the similar program for select query ,but in this program it's giving me an error "java.lang.ClassNotFoundException: com.jdbc.mysql.Driver ".this error is related to classpath and i set it perfectly. What's the problem???
import java.sql.*;
import java.io.*;
class newacc
{
public static void main(String args[])
{
String nm,pass,city;
InputStreamReader is=new InputStreamReader(System.in);
BufferedReader br= new BufferedReader(is);
Connection con;
Statement st;
try
{
//taking input in java
System.out.println("enter name");
nm=br.readLine();
System.out.println("enter password");
pass =br.readLine();
System.out.println("enter city");
city=br.readLine();
//jdbc activities
Class.forName("com.jdbc.mysql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/forjava?user=root&password=123");
st=con.createStatement();
st.executeUpdate("insert into users values("+nm+","+pass+","+city+");");
System.out.println("account opened successfully");
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}