DBCP2 의존성 추가
... <dependencies> ... <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> </dependency> ... </dependencies> ...
pom.xml
Properties 설정부분
spring.datasource.type=org.apache.commons.dbcp2.BasicDataSource spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost/test spring.datasource.username=test spring.datasource.password=test spring.datasource.validation-query=SELECT 1
src/main/resources/application.properties
*validation-query
: java에서 DB를 사용하기 전에 해당 connection 이 정상적인지 검사를 하도록 하는 옵션
- Oracle ( select 1 from dual )
- hsqldb ( select 1 from INFORMATION_SCHEMA.SYSTEM_USERS )
- DB2 ( select 1 from sysibm.sysdummy1 )
- mysql ( select 1 )
- microsoft SQL Server ( select 1 (tested on SQL-Server 9.0, 10.5 [2008]) )
- postgresql ( select 1 )
- ingres ( select 1 )
- derby ( values 1 )
- H2 ( select 1 )
- Firebird ( select 1 from rdb$database )
댓글 없음:
댓글 쓰기
참고: 블로그의 회원만 댓글을 작성할 수 있습니다.