I have installed MySql and edited my CLASSPATH(variable) to the path specifying the connector.
Now when I am running this code using java TestConnection it gives me ClassNotFoundException.
I am not getting where I am doing wrong. How can I get it correct?
Now when I am running this code using java TestConnection it gives me ClassNotFoundException.
I am not getting where I am doing wrong. How can I get it correct?
import java.sql.*; public class TestConnection { public static void main(String[] args)throws ClassNotFoundException { Class.forName("com.mysql.jdbc.Driver") ; Connection conn = null; String url = "jdbc:mysql://localhost:3306/student"; String userName = "root"; String password = "twinrdmighty"; try { conn = DriverManager.getConnection(url,userName,password); Statement stat = conn.createStatement() ; stat.execute("create table student(fname varchar(100), lname varchar(100))") ; } catch(Exception e) {} } }