Hi all,
Im fairly new to java. Im wanting to connect to mysql but the following is thrown
Exception: com.mysql.jdbc.Driver
have i missed something?
here is the code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class MySql {
public static void main(String args[]) throws Exception
{
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test",
"username", "password");
if(!con.isClosed())
System.out.println("Successfully connected to " +
"MySQL server using TCP/IP...");
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}