Connection, DriverManager, PreparedStatement 모두 java.sql패키지에 들어있음

DriverManager > Connection
Connection > PreparedStatement
PreparedStatement에서 sql을 DB로 전달, DB에서 sql실행후 결과 받기까지함


DB작업 끝나면
Connection, Statement, ResultSet모두 close() 해줘야함
: 리소스 정리, 안하면 리소스 누수
MySQL드라이버가 JDBC인터페이스를 구현해서 실질적으로 DB와 작업( DB와 연결, SQL전달, 결과 받기 등 )함
com.mysql.cj.jdbc. ConnectionImpl
com.mysql.cj.jdbc. ClientPreparedStatement
com.mysql.cj.jdbc. result. ResultSetImpl
위 클래스들이 실제로 위( MySQL에서 작업 )에서 사용되는 Connection, PreparedStatement, ResultSet
'Spring > DB연동' 카테고리의 다른 글
| Spring에서 Elasticsearch 기본편 01 (0) | 2025.01.04 |
|---|---|
| MySQL에서 Session확인 (0) | 2024.10.26 |
| (JPA의 CRUD메서드) ~ (DB에서 SQL문 수행) 까지의 과정 (0) | 2024.10.19 |
| Querydsl 01 (0) | 2024.07.04 |
| JPA 01 (0) | 2024.07.02 |