gpt4 book ai didi

java - 使用 Java 和 Mysql 获取异常 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException :

转载 作者:行者123 更新时间:2023-11-29 04:36:11 24 4
gpt4 key购买 nike

<分区>

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:你的 SQL 语法有错误;查看与您的 MySQL 服务器版本对应的手册,了解在“?”附近使用的正确语法。在第 1 行得到这个异常

        private String selectCustDetail= "SELECT NAME, PASSWORD, RESID, ACTIVATED, USERTYPE FROM USERDETAIL WHERE MOBILENO=?";

ResultSet rs;
//PreparedStatement preparedStatement = null;
PreparedStatement preparedStatement = null ;
try {
// preparedStatement = con.prepareStatement(selectCustDetail);
preparedStatement = con.prepareStatement(selectCustDetail);

preparedStatement.setString(1, mobileno.toString().trim());

rs = preparedStatement.executeQuery(selectCustDetail );
while (rs.next()) {
// LOGGER.info("fetching - 1" + mobileno);
System.out.println(rs.getString("name"));
userDetai.setName(rs.getString("name"));
userDetai.setPassword(rs.getString("password"));
userDetai.setRestaurant(rs.getString("resId"));
userDetai.setActivated(rs.getString("activated"));
userDetai.setType(rs.getString("userType"));
// LOGGER.info("fetching - 2" + userDetai.getActivated());


}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//LOGGER.info("Exception - " + e.getMessage());
dinepostcons.msg = dinepostcons.dbError;
return false;
}
finally
{try {
if (preparedStatement != null) {
preparedStatement.close();
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com