i don't know what is the problem with my code,
can pls someone help me on this one, pls.
hire's my code:
import java.sql.*; public class Connect { public static void main(String[] args) { Connection conn = null; try { String userName = "root"; String password = "kickass"; String url = "jdbc:mysql://localhost:3306/student"; Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url, userName, password); System.out.println("Database connection established"); } catch (Exception e) { System.err.println("Cannot connect to database server: " + e.getMessage()); } finally { if (conn != null) { try { conn.close(); System.out.println("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } } }
and hire's the error:
Cannot connect to database server: com.mysql.jdbc.Driver