Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to Connect My Desktop application with mySQL server that is hosted on my webHosting Site and Facing This Exception Please Help!
MY CODE:
Java
public static void main(String[] args) {
		try {
			Class.forName ("com.mysql.jdbc.Driver");
			String url = "jdbc:mysql://mysql.1freehosting.com/u114747985_mydb";
			Connection connection = DriverManager.getConnection(url);
			JOptionPane.showMessageDialog(null,"Success!");
		} catch (Exception e) {
			// TODO: handle exception
			JOptionPane.showMessageDialog(null,e.toString());
			e.printStackTrace();
		}
	}
	
}

<br />
SQLException: null,  message from server: "Host '119.156.14.70' is not allowed to connect to this MySQL server"<br />
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)<br />
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)<br />
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)<br />
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1128)<br />
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)<br />
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)<br />
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)<br />
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)<br />
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)<br />
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)<br />
	at java.lang.reflect.Constructor.newInstance(Unknown Source)<br />
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)<br />
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)<br />
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)<br />
	at java.sql.DriverManager.getConnection(Unknown Source)<br />
	at java.sql.DriverManager.getConnection(Unknown Source)<br />
	at MyTest.main(MyTest.java:16)<br />
Posted

 
Share this answer
 
Comments
Shariq93 29-Nov-14 14:19pm    
Searched So much but Still Can't understand this problem!
check firewall settings and add execption for mysql for its port
 
Share this answer
 
Comments
Shariq93 29-Nov-14 14:18pm    
Still Not Working Bro !
dear did you installed the skype? if yes please remove it and try again.may this is the problem
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900