Connecting to mySql
import java.sql.*;
publicclass DataBaseTest{
publicstaticvoid main(String args[]){
try{
Statement stmt;
ResultSet rs;
//Register the JDBC driver for MySQL.
Class.forName("com.mysql.jdbc.Driver");
String url =
"jdbc:mysql://66.98.198.194:3306/highscores";
//^^^^ ip of web server
Connection con =
DriverManager.getConnection(
url,"username","password");
//Display URL and connection information
System.out.println("URL: " + url);
System.out.println("Connection: " + con);
//Get a Statement object
stmt = con.createStatement();
stmt.executeUpdate(
"INSERT INTO myScores(name, " +
"score) VALUES('Stuart',132)");
stmt = con.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery("SELECT * " +
"from myScores ORDER BY score");
con.close();
}catch( Exception e ){
e.printStackTrace();
}
}
}
With that code I get the error "java.sql.SQLException: null, message from server: "Host 'pool-71-164-175-190.dllstx.fios.verizon.net' is not allowed to connect to this MySQL server"
The user/pass is correct and the user has full priviledges;
I think the problem is that I need to log onto the webserver, but I couldn't find any code examples on how to do that. It worked fine when I was testing it with localhost.
Any idea's? I'm trying to use this for a highscore table for my java game.

