1. DriverManager를 이용
<bean id=”dataSource” class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>
<property name=”driverClassName” value=”oracle.jdbc.OracleDriver”/>
<property name=”url” value=”jdbc:oracle:thin:@localhost:1521:orcl”/>
<property name=”username” value=”scott”/>
<property name=”password” value=”tiger”/>
</bean>
…
2. DBCP를 이용
* jar 파일 : common-dbcp.jar, commons-pool.jar
<bean id=”dataSource” class=”org.apache.commons.dbcp.BasicDataSource”>
<property name=”driverClassName” value=”oracle.jdbc.OracleDriver”/>
<property name=”url” value=”jdbc.oracle.thin:@localhost:1521:orcl”/>
<property name=”username” value=”scott”/>
<property name=”password” value=”tiger”/>
</bean>
3. JNDI 이용
[context.xml]
<?xml version=”1.0″ encoding=”UTF-8″?>
<Context>
<Resource name=”jdbc/mydb” auth=”Container” type=”javax.sql.DataSource” driverClassName=”oracle.jdbc.OracleDriver” url=”jdbc:oracle:thin:@localhost:1521:orcl” username=”scott” password=”tiger” maxActive=”20″ maxIdle=”10″ maxWait=”-1″/>
</Context>
…
<bean id=”dataSource” class=”org.springframework.jndi.JndiObjectFactoryBean”>
<property name=”jndiName” value=”java.comp/env/jdbc/myoracle”/>
4. DriverManagerDataSource 클래스를 이용
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(“oracle.jdbc.OracleDriver”);
dataSource.setUrl(“jdbc:oracle:thin:@localhost:1521:orcl”);
dataSource.setUsername(“scott”);
dataSource.setPassword(“tiger”);
'프로그램 > Etc' 카테고리의 다른 글
[기타] 구글날씨API 도시별 정보 (0) | 2014.02.17 |
---|---|
[Spring] Spring JDBC – JdbcTemplate 사용 예제 (0) | 2014.02.16 |
[iBatis] sql문에 한글 추가시, 한글 깨짐현상 (0) | 2014.02.12 |
[Log4j] Log4j 설정 Reference (0) | 2014.02.11 |
[VisualSVN] 백업 및 복구 (0) | 2014.01.04 |