package dbb;
import java.sql.*;
public class test {
public static void main (String[] args) {
String url = "jdbc:mysql://localhost:3306/test";
String user = "root";
String pass = "1234";
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Searched");
conn = DriverManager.getConnection(url, user, pass);
System.out.println("Connection Succeed" + conn);
} catch (ClassNotFoundException e) {
System.out.println("Driver Not Searched");
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
i made this code on java, but there are some errors.
for example,
.
It shows that Driver is already searched, but the connection is still failed.
How can i fix the error?