Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ユーザーIDを取得する
- public int getUserID(String loginName, String password) {
- int userid = -1;
- try(
- Connection con =
- DriverManager.getConnection("jdbc:oracle:thin:@xx.xx.xx.xx:1521:xxxx", "xxxx", "xxxx");
- 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)) {
- userid = rs.getInt("ID");
- }
- }
- }
- catch(SQLException ex) {
- userid = -1;
- }
- return userid;
- }
Add Comment
Please, Sign In to add comment