-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientDAO.java
More file actions
34 lines (23 loc) · 753 Bytes
/
ClientDAO.java
File metadata and controls
34 lines (23 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package sec06;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class ClientDAO {
private Connection conn;
public ClientDAO() throws Exception {
conn = DBConnect.getConnection();
}
public boolean login(int clientNo, String password) {
String sql = "SELECT * FROM CLIENT WHERE CLIENTNO=? AND CLIENTPASSWORD=?";
try {
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, clientNo);
pstmt.setString(2, password);
ResultSet rs = pstmt.executeQuery();
if(rs.next()) return true;
} catch(Exception e) {
e.printStackTrace();
}
return false;
}
}