我的基于Web服务的应用程序出现词汇错误。如何解决这个问题?请帮帮我。
@WebMethod(operationName = "operation")
public String operation(@WebParam(name = "username") String username, @WebParam(name = "password") String password){
String message = "";
Connection myConObj = null;
Statement myStatObj = null;
PreparedStatement ps;
ResultSet myresObj = null;
String query = "SELECT `USERNAME`, `PASSWORD` FROM HIRUNA.BANKLOGIN WHERE `USERNAME`=? AND `PASSWORD`=?";
try{
myConObj = mybank.getConnection();
ps = myConObj.prepareStatement(query);
ps.setString(1, username);
ps.setString(2, password);
ResultSet result = ps.executeQuery();
result.next();
message = "Success!";
result.close();
myConObj.close();
return message;
}catch(SQLException ex){
Logger.getLogger(login.class.getName()).log(Level.SEVERE, null, ex);
return message;
}
}
这是错误..
严重:java.sql.SQLSyntaxErrorException:第1行的词法错误, 第8栏。遇到:"`" (96),之后:""。
答案 0 :(得分:0)
删除后面的刻度:
String query = "SELECT USERNAME, PASSWORD FROM HIRUNA.BANKLOGIN WHERE USERNAME=? AND PASSWORD=?";