import com.uis.loginuser.client.GreetingService;
import com.uis.loginuser.shared.FieldVerifier;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import java.net.ConnectException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
//import com.client.GreetingService;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*/
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet
implements
GreetingService {
Connection con=null;
Statement st=null;
ResultSet rs=null;
//jdbc:mysql://your.database.domain/yourDBname
//String url="jdbc:mysql://localhost:10081/phpMyAdmin";
String url="jdbc:mysql://192.168.2.23:8888/mydb";
public void call()
{
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception e) {
e.printStackTrace();
}
try
{
con=DriverManager.getConnection(url, "root", "");
st=con.createStatement();
}
catch(SQLException ex)
{
//System.out.println(ex.getMessage());
}
}
public String check(String s1, String s2) {
String ss="no";
call();
try
{
rs = st.executeQuery("select * from login where name='" + s1 + "'
and password='" + s2+"'" );
if(rs.next())
{
ss="yes";
System.out.println(rs.getString(0));
System.out.println(rs.getString(1));
}
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
return ss;
}
@Override
public String newuser(String name, String password) {
String ss = "no";
call();
try
{
boolean ss1;
ss1 = st.execute("insert into login values('" + name+"','"+
password +"')");
if(ss1)
{
ss="yes";
}
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
return ss;
}
}
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment