This question has been asked before but none of the solutions are working for me. I'm getting the following error
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
when I'm executing the following code
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class MyFirstDBConn {
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/repository";
// Database credentials
static final String USER = "root";
static final String PASS = "pass";
public static void main(String[] args) {
try{
System.out.println("Register the DriverManager with DB driver");
Class.forName(JDBC_DRIVER );
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
Statement statement = conn.createStatement();
......
}
}
}
Please help.