terça-feira, 3 de março de 2015

Unable to connect to AWS instance - access denied for user

Geez this one was a old one. Workbench connected well, the Eclipse AWS plugin fine and when trying to connect using the application.properties, puft...
I had a tab after the username....


I tried to test first through code, lol, next time around i will check the file first.

A simple test you can do:

public static void testMySQLConnection() {
System.out.println("-------- MySQL JDBC Connection Testing ------------");

try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
return;
}

System.out.println("MySQL JDBC Driver Registered!");
Connection connection = null;

try {
connection = (Connection) DriverManager.getConnection("jdbc:mysql://jlo.cefietgq5w13.us-west-2.rds.amazonaws.com:3306/dbname","username", "password");
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}

if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
} }

Oh well i must be sleepy today

Sem comentários: