DBConn dBConn = new DBConn();
PreparedStatement prepareStatement;
Connection con = dBConn.getDBConnectionForPro();
prepareStatement = con.prepareStatement("SELECT * FROM TBL_MASCONFIGTTB WHERE SERVICE_NAME=GUPSHUP AND VALUE=TRUE");
if (prepareStatement.equals("true")) {
System.out.println(GenerateLinkDaoImpl.sendOTP("90xxxxxxxx", smsBody));
}
else {
System.out.println(GenerateLinkDaoImpl.SendSms("90xxxxxxxx", smsBody));
}
答案 0 :(得分:0)
您不能在PreparedStatement上使用布尔值,而需要首先使用ResultSet。 尝试使用下面的代码。
DBConn dBConn = new DBConn();
PreparedStatement prepareStatement = null;
ResultSet rs = null;
Connection con = dBConn.getDBConnectionForPro();
prepareStatement = con.prepareStatement("SELECT * FROM TBL_MASCONFIGTTB WHERE SERVICE_NAME=GUPSHUP AND VALUE=TRUE");
rs = prepareStatement.executeQuery();
if (rs.next()) {
System.out.println(GenerateLinkDaoImpl.sendOTP("90xxxxxxxx", smsBody));
}
else {
System.out.println(GenerateLinkDaoImpl.SendSms("90xxxxxxxx", smsBody));
}