hi
can anyone explian me how to connect jdbc in mysql??
i created 1 application which is not conecting to database.
import java.sql.*;
public class MYSQLDEMO {
public static void main(String[] args) throws SQLException,ClassNotFoundException{
String driverClass="sun.jdbc.odbc.JdbcOdbcDriver";
String url="jdbcdbc:msqldsn";
String user="root";
String password="test";
Class.forName(driverClass);
Connection con=DriverManager.getConnection(url,user,password) ;
Statement st=con.createStatement();
String sql="insert into student values(23,nit,45)";
st.executeUpdate(sql);
System.out.println("query executed");
con.close();
}
}
after running this it is showing like this
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknow n Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MYSQLDEMO.main(MYSQLDEMO.java:11)
thankyou