-
카테고리
-
세부 분야
백엔드
-
해결 여부
해결됨
커넥션 풀에 대해서 질문이 있습니다.
23.03.28 22:32 작성 조회수 288
1
커넥션 풀 없이 사용한다고 한다면
public void delete(String memberId) throws SQLException {
String sql = "delete from member where member_id = ?";
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, memberId);
pstmt.executeUpdate();
} catch (SQLException e) {
log.error("db error", e);
throw e;
} finally {
close(conn,pstmt,null);
}
}
여기서 말하는 커넥션 풀이
getConnection()
으로 URL과 아이디와 비밀번호를 넘겨서
TCP/IP로 DB와 통신을 유지하는 상태를 끊지 않고
반환만 한다고 들었는데요
그럼여기서 PreparedStatement,ResultSet은 사용하고
close()를 하고 커넥션만 유지한다고 이해하면 될까요?
답변을 작성해보세요.
2
답변 1