I was trying to connect to MySQL using JAVA I used the same code to connect the database in my localhost. Now I tried to use it in my system to update the remote database. Here is my code:
import java.sql.*;
class mysqlConnect {
public static void main (String[] args) {
try {
String url = "jdbc:mysql://dibyaranjan.net76.net/a3932573_product";
Connection conn = DriverManager.getConnection(url,"a3932573_dibya","*****");
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO emp_oracle " + "VALUES (1001, 'Dibya', 'AAA')");
conn.close();
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
}
I get this error message:
null, message from server: “Host ‘49.204.14.98’ is not allowed to connect to this MySQL server”.
The ip is my public ip.
Your host is configured incorrectly in the
mysql.usertable.Open
PHPMyAdminand find your record in themysql.usertable.ALTERthe table so that instead oflocalhost,127.0.0.1or any other IP, the hostname reflects your actual IP (or%if you wish to allow connections from every IP. Note however that most shared hosts do not allow this sort of configuration.For more reference: http://blog.wassupy.com/2011/02/host-is-not-allowed-to-connect-to-this.html