2009. 5. 19. 08:38
[JSP] PreparedStatement 메모2009. 5. 19. 08:38
JSP에서 쿼리문을 사용할 때 PreparedStatement를 사용하는 방법.
1. 객체생성
PreparedStatement pStmt = connect.prepareStateme("select id, name from table where id = ?");
2. ? 에 값 지정
setInt(1, id_value)
or
setString(1, id_value)
3. 실행
ResultSet rs = pStmt.executeQuery();
pStmt.close();
1. 객체생성
PreparedStatement pStmt = connect.prepareStateme("select id, name from table where id = ?");
2. ? 에 값 지정
setInt(1, id_value)
or
setString(1, id_value)
3. 실행
ResultSet rs = pStmt.executeQuery();
pStmt.close();