Hi friends,
I am using Netbeans 6.0.1 and I've installed MySql on Fedora 8...I 've been able to configure the jdbc-MySql connector that's bundled with Netbeans and I can create tables and query MySql using the Netbeans GUI.So I guess my connection was correct...My connection properties are as follows:
Database URL - jdbc:mysql://localhost:3306/test
Driver - com.mysql.jdbc.Driver
But when I execute the code below I get a ClassNotFoundException:
code:
Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(url,"root","<pwd>");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from login");
while(rs.next())
{
DbUserName=rs.getString("Username");
DbPassword = rs.getString("Password");
System.out.println(DbUserName);
System.out.println(DbPassword);
}
}
catch(Exception d)
{
System.out.println("" + d);
}
}
I get the following output:
init:
deps-jar:
compile:
run:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
BUILD SUCCESSFUL (total time: 4 seconds)
Any pointers to what I am doing wrong will be greatly appreciated...Thanks in advance...