package mysqlTest;
import java.sql.*;
public class NewClass{
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance( );
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/test",
"root","****");
ResultSet cursor = conn.createStatement( ).executeQuery(
"INSERT into javatest VALUES('Steve', 'Granet')");
conn.close( );
}
catch (Exception e){
System.err.println(e);
}
}
}
okay im using netbeans, the newest versions of mysql, connector/j, jdk, everything right. and this file compiles fine, but when i run it i get an error...
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
compile-single:
run-main:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
BUILD SUCCESSFUL (total time: 1 second)
now i added the connection to netbeans, all worked fine right, i can connect to my database, but when i do it through my own code it doesnt work.