Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UserDAO {
- //ログイン名 パスワード が一致する数を返す
- //@param roginName ログイン名
- //@param password パスワード
- //@return 結果を返す
- public int getCount(String loginName, String password) {
- int cnt = 0;
- try(
- Connection con =
- DriverManager.getConnection("jdbc:oracle:thin:@xx.xx.xx.xx:1521:xxxx", "xxx", "xxx");
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(
- "select ID, 氏名, パスワード, ログイン名 from 異常系1_ユーザーマスタ order by ID asc");
- )
- {
- while(rs.next()) {
- if(rs.getString("ログイン名").equals(loginName) && rs.getString("パスワード").contentEquals(password)) {
- cnt++;
- }
- }
- }
- catch(SQLException ex) {
- cnt = 0;
- }
- return cnt;
- }
Add Comment
Please, Sign In to add comment