I'm trying to give access to client computer from my server and also tryin to revoke the granted access... the grant is successful but the revoking is not working please help.
hms is the satabase that i want to give access to my clients..
my code
try {
Connection con = getDBConnection();
Statement stmt = con.createStatement();
if (sts == true) {
String query = "GRANT INSERT,SELECT,UPDATE,DELETE ON hms.* TO '" + MainFrame.dbUser + "'@'" + ip + "' IDENTIFIED BY '" + MainFrame.dbPassword + "'";
stmt.execute(query);
System.out.println(query);
JOptionPane.showMessageDialog(null, "Permission granted to '" + ip + "' !");
}
else{
String query ="REVOKE INSERT,SELECT,UPDATE,DELETE on hms.* FROM '"+MainFrame.dbUser+"'@'"+ip+"' identified by '"+MainFrame.dbPassword+"';";
stmt.execute(query);
System.out.println(query);
JOptionPane.showMessageDialog(null, "Permission denied for '" + ip + "' !");
}
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Failed");
}
this is the error i get
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'howday'@'192.168.1.69' to database 'hms'
please help!!!