I'm trying to make a minecraft plugin. I'm using ouiheberg to host my server and they give 5 databases with the server. So, I tried to put something in the database but it always returns me << Access denied for user 'mylogin'@'%' to database 'Points' >>.
I have checked in the USER_PRIVILAGE table and I've USAGE privilege. I don't really know if I have all permissions or not but I think no because I can't insert in the table so.
I didn't specify that I'm using PHPMyAdmin and MySQL server 2.
My code :
public static void savePoint(String name, double x, double y, double z) {
String url = "jdbc:mysql://45.140.165.82:3306/Points";
String login = "mylogin";
String mdp = "mypassword";
Connection connection = null;
Statement statement = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url, login, mdp);
statement = connection.createStatement();
String sql = "INSERT INTO Points (name, x, y, z) VALUES ('" + name + "', '" + x + "', '" + y + "', '" + z + "')";
statement.executeUpdate(sql);
} catch (SQLException | ClassNotFoundException e) {
e.printStackTrace();
} finally {
try {
if (connection != null) {
connection.close();
}
if (statement != null) {
statement.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}