Hello guys
so i am just getting to terms with using gwt and the rpc services that i can implement.
So i began with the gwt greeting service started project.(all gwt users know this starter app) all i wanted to do was to press the send button on the web page. it would retrieve a simple string from my database and display it on the webpage.
within the greeting service implmentation which is on the server side i call this code
public String greetServer(String input) throws IllegalArgumentException {
Connection conn = null;
Statement statement = null;
ResultSet rs = null;
String data = "error";
try {
data = "error 1";
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/newtest?" +
"user=root");
data = "error 2";
statement = (Statement) conn.createStatement();
rs = statement.executeQuery("SELECT * FROM example_autoincrement");
rs.next();
data = rs.getString("data");
} catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState());
}
return data;
}
when i run this code in an application that is not server side. it runs and prints out a simple string with no errors.
when run it in a gwt application i get this error
SQLException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
SQLState: 08S01
also data is what is sent back to the client and the reply is error 1. so i understand that the error is occuring at
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/newtest?" + "user=root");
this line