我对编码密码有一些问题,我该怎么办呢.编码类型md5
digest(data text, type text) returns bytea;
CREATE OR REPLACE FUNCTION md(bytea) returns text AS $$
SELECT encode(digest($1, 'sha1'), 'md5')
$$ LANGUAGE SQL STRICT IMMUTABLE;
INSERT INTO "login"(login, password, employee_id)
VALUES ( 'email',crypt('password', md('md5')), 1);
Run Code Online (Sandbox Code Playgroud)
*** 错误 ***
ERROR: syntax error at or near "digest"
SQL state: 42601
Character: 1
Run Code Online (Sandbox Code Playgroud) 我在将 java servlet 与 postgresql 连接时遇到了一些问题。如果可以,请帮助我
String dbName = "jdbc:postgresql://localhost/schedule_of_holidays";
String dbDriver = "org.postgresql.Driver";
Class.forName(dbDriver);
Connection con = DriverManager.getConnection(dbName, userName,
password);
System.out.println("Got Connection");
Statement statement = con.createStatement();
String sql = "select id from registration";
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
System.out.println(rs.getInt("id"));
}
Run Code Online (Sandbox Code Playgroud) 我尝试删除会话,但无法做到这一点。
private boolean removeSession(HttpServletRequest request) {
boolean success = false;
HttpSession session = request.getSession(false);
if (session != null) {
request.getSession(true).invalidate();
success = true;
}
return success;
}
Run Code Online (Sandbox Code Playgroud)