【发布时间】:2014-01-22 09:22:07
【问题描述】:
服务器端代码从数据库中检索一个值。但我无法向客户端提供价值。请帮帮我。
服务器端代码:
public int result(int ss) throws Exception
{
Class.forName("com.mysql.jdbc.Driver");
String host="jdbc:mysql://localhost/test";
String username="root";
String password="";
Connection connect=DriverManager.getConnection(host,username,password);
System.out.println("Works");
Statement s =connect.createStatement();
s.execute("select * from customer");
ResultSet rs=s.getResultSet();
while(rs.next())
{
ss=rs.getInt(1);
System.out.println("Retrieved element is = " + ss);
}
return ss;
}
客户端代码:
public class sam {
public static void main(String[] args) throws RemoteException {
Sample1Stub stub = new Sample1Stub();
Result method = new Result();
method.getSs();
ResultResponse response = stub.result(method);
System.out.println(response.get_return());
}
}
【问题讨论】:
标签: java eclipse web-services axis2