I can gwt-rpc communication with server sucessfully.
but when i want to interact with mysql I get following error
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to database server.
I added mysql connector to WEB-Inf/lib dierctory
following is my code that tries to connect to data base
public String login(String usr,String pwd)
{
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/
SeekwadiDataBank";
String db = "SeekwadiDataBank";
String driver = "com.mysql.jdbc.Driver";
String user = "user";
String pass = "user";
String connerr=null;
try
{
connerr="Connecting ....";
Class.forName(driver).newInstance();
connerr+="Still Working....";
//Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, user, pass);
connerr="Conncted....";
} catch (Exception e) {
// TODO: handle exception
connerr+=e.toString();
}
return connerr;
}
i cannot give full stack trace becuse it is not available at client
side
client side code taht communicate asynchronoulsy to server is
Hyperlink login = new Hyperlink("Login", "Login");
login.addClickListener(new ClickListener() {
public void onClick(Widget widget)
{
hp.clear();
final TextBox usr=new TextBox();
final PasswordTextBox pwd=new PasswordTextBox();
Button loginb=new Button("Login");
loginb.addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent event)
{ //Window.alert("Starts");
AsyncCallback callback = new AsyncCallback()
{
public void onSuccess(Object result)
{
if(((String) result).equals("Ok"))
{ Window.alert("Login
Status:"+result.toString());
usr.setText(""); pwd.setText(""); }
else { Window.alert("Login
Status:"+result.toString()); usr.setText(""); pwd.setText(""); }
}
public void onFailure(Throwable caught)
{ Window.alert(caught.getMessage()); }
};
no.login(usr.getText(),pwd.getText(), callback);
//Window.alert("Ends");
}
});
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.