I have written a small code to get connection with mysql database. But it throws exception
.
this is my code...
Code:
No suitable driver
this is my code...
Code:
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:/home/pjerald/Installs/mysql-standard-4.1.16-pc-linux-gnu-i686/data:///test","pjerald", "5623");
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) {}
}
}
Comment