0
我在java soap服務上編寫了一個操作來查詢數據庫,然後顯示我在客戶端jsp頁面上搜索到的數據。但是,我無法顯示它,變量「rs」不能改變,我不知道爲什麼?有人可以幫我找到這個骰子嗎? 這是我對SOAP服務創建調度研究:肥皂查詢數據庫
@WebMethod(operationName = "query")
public String query(@WebParam(name = "parameter") String parameter) {
ResultSet rs;
try {
Connection con = data1.getConnection();
Statement statement = con.createStatement();
String QueryString;
QueryString = "SELECT * from stud where name= parameter";
rs = statement.executeQuery(QueryString);
while (rs.next()) {
System.out.println(rs.getInt(1) + " " + rs.getString(2) + "\n");
}
} catch (Exception ex) {
System.out.println("Unable to connect to batabase.");//TODO write your implementation code here:
}
//TODO write your implementation code here:
return null;
}
問題是什麼?它總是返回'null',所以... – 2012-04-14 03:36:33