Spring JDBC 11.3. Controlling database connections 11.3.1. DataSourceUtils JNDI 를 사용하여 connection을 얻어오고 필요 없을 때 반환할 때 사용할 수 있는 편리한 static 메소드들을 제공하는 클래스입니다. 11.3.2. SmartDataSource Classes using this interface can query whether or not the Connection should be closed after an operation. Spring&
Spring JDBC 11.2.2. NamedParameterJdbcTemplate 이전 글에서 JdbcTemplate을 사용하여 쿼리를 작성할 때 ? 를 사용하였는데요. 쿼리에 필요한 파라미터가 여러개 라면 ? 의 순서를 신경써야 하는 단점이 생깁니다. 이때 JdbcTemplate 클래스를 감싸고 있는 NamedParameterJdbcTemplate 클래스를 사용하면 됩니다. getJdbcOperations() 메소드를 사용해서 감싸고 있는 JdbcTempate 객체를 받아와서 사용할 수 있습니다. private NamedParameterJdbcTemplate namedParameterJdbcTemplate; public
Spring JDBC 11.2.1. JdbcTemplate – query() :: select 문 사용위와 같이 다양한 query 메소드들을 제공하고 있습니다. 예제 코드들) int rowCount = this.jdbcTemplate.queryForInt(“select count(0) from t_accrual”); int countOfActorsNamedJoe = this.jdbcTemplate.queryForInt(“select count(0) from t_actors where first_name = ?”
Spring Reference 11장 Data access using JDBC 11.1. Introduction Spring 프레임워크의 JDBC 추상화 계층이 제공하는 장점들은 다음과 같으며 저 중에서도 굵은 글자 부분만이 개발 할 때 코딩이 필요한 부분입니다. connection 정보 정의 하기connection 열기statement 만들기(쿼리 작성)statement 객체 준비하고 실행하기resultSet 을 이터레이션 돌기 위한 루프 세팅각 이터레이션 마다 작업