我试图从 db 中获取关于已完成查询的结果,db 总是让我“假”,即使那是真的。
oldPassword = DBConfig.MD5(oldPassword); //thase are me own classes
newPassword = DBConfig.MD5(newPassword);
String updatePassword = "UPDATE login " + "SET password='"
+ newPassword + "'" + " WHERE password='" + oldPassword
+ "' and employee_id=" + userId + " ;";
Connection con = DBConfig.dbConfigure();
Statement statement = con.createStatement();
boolean success = statement.execute(updatePassword);
LOGGER.info(success);
DBManager.close(con, statement, null); //I'm closing connectin,statmant and result set if that has
/ * ** * ** * ** * ** * ** * **** / DBConfig
public static final String USER_NAME = "postgres";
public static final String PASSWORD = "password";
public static final String DB_NAME="jdbc:postgresql://localhost/myTask";
public static final String DB_DRIVER = "org.postgresql.Driver";
public static Connection dbConfigure() throws ClassNotFoundException,
SQLException {
String userName = USER_NAME;
String dbPassword = PASSWORD;
String dbName = DB_NAME;
String dbDriver = DB_DRIVER;
Class.forName(dbDriver);
Connection con = DriverManager.getConnection(dbName, userName,
dbPassword);
return con;
}