JDBC going to the wrong address
- by DCSoft
When I try and connect it my mysql database with JDBC in java, it doesn't go to my web server.
Here is the code
String dbtime;
String dbUrl = "jdbc:mysql://184.172.176.18:3306/dcsoft_dcsoft_balloon";
String dbUser = "myuser";
String dcPass = "mypass";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(dbUrl, dbUser, dcPass);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
dbtime = rs.getString(1);
System.out.println(dbtime);
} //end while
con.close();
} //end try
catch(ClassNotFoundException e) {
e.printStackTrace();
}
catch(SQLException e) {
e.printStackTrace();
}
This code is supposed to go to my web server but it gives this error
java.sql.SQLException: Access denied for user 'dcsoft_dcsoft_java'@'jamesposse.force9.co.uk' (using password: YES)
jamesposse.force9.co.uk is the not the address im trying to connect to I'm trying to connect to 184.172.176.18:3306.
Thanks.