Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.
* 참고 : http://iloveulhj.github.io/posts/java/java-commonsDBCP.html
-----------------------------DB설정 부분 -----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="dataSourceSpied" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close" >
<property name="driverClassName" value="org.mariadb.jdbc.Driver"/>
<property name="url" value="jdbc:mariadb://db1:3306/sda"/>
<property name="username" value="계정명"/>
<property name="password" value="패스워드"/>
<property name="maxTotal" value="30" />
<property name="maxIdle" value="20" />
<property name="maxWaitMillis" value="-1" />
<property name="validationQuery" value="select 1" />
<property name="testOnBorrow" value="false" />
<property name="testWhileIdle" value="true" />
<property name="maxOpenPreparedStatements" value="10" />
<property name="poolPreparedStatements" value="true" />
<bean id="dataSource" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
<constructor-arg ref="dataSourceSpied" />
<property name="logFormatter">
<bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter">
<property name="loggingType" value="MULTI_LINE" />
<property name="sqlPrefix" value="SQL : "/>
</bean>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
</beans>
댓글 0
번호 | 제목 | 날짜 | 조회 수 |
---|---|---|---|
9 | [springframework]Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 오류 발생시 조치사항 | 2017.01.23 | 957 |
» | mybatis와 spring을 org.apache.commons.dbcp2.BasicDataSource의 DataSource로 연동할때 DB설정(참고) | 2016.10.31 | 1146 |
7 | Caused by: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 오류시 확인/조치할 내용 | 2016.10.31 | 4185 |
6 | DBCP Datasource(org.apache.commons.dbcp.BasicDataSource) 설정 및 속성 설명 | 2016.09.26 | 937 |
5 | [Mybatis]Spring과 연동하지 않고 Java+Mybatis 형태의 프로그램 샘플소스 | 2016.09.01 | 1008 |
4 | 초기 오류(java.lang.NoSuchMethodError)에 따른 후속 작업에서 오류(java.lang.NoClassDefFoundError)가 발생되는 상황(quartz에서 주기적으로 작업시) | 2016.08.29 | 735 |
3 | 마이바티스(MyBatis)쿼리로그 출력및 정렬하기 | 2015.12.01 | 1590 |
2 | mybais #과 $의 차이점 | 2015.11.10 | 818 |
1 | Mybatis foreach 문법정리(상황에 따른 사용법) | 2015.11.10 | 1769 |