Springboot2.1.6整合activiti7出現登入驗證的實現
阿新 • • 發佈:2020-12-29
技術標籤:Mysql
// 1.註冊驅動
Class.forName("com.mysql.cj.jdbc.Driver");
// 2.獲取連線
String url = "jdbc:mysql://localhost:3306/mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT";
String username = "root";
String password = "123456";
Connection conn = DriverManager.getConnection(url,username,password);
// 3.建立PreparedStatement物件
PreparedStatement ps = conn.prepareStatement("select * from user ");
// 4.執行Sql
ResultSet rs = ps.executeQuery();
// 5.處理結果集
while (rs.next()) {
// 輸出名字
System.out.println(rs.getString("username"));
}
// 6.關閉資源
ps.close();
ps.close();
conn.close();