DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Haikal has posted 8 posts at DZone. View Full User Profile

Single Connection Data Source Example, With Oracle

03.23.2009
| 12663 views |
  • submit to reddit
        Single Connection Data Source example, with Oracle
<?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:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
	<context:property-placeholder location="classpath:jdbc.properties"/>
	<bean class="oracle.jdbc.driver.OracleDriver" /><!-- Register the driver -->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
		<constructor-arg value="${jdbc.url}" />
		<constructor-arg value="${jdbc.username}" />
		<constructor-arg value="${jdbc.password}"/>
		<constructor-arg value="true"/> <!-- suppress close -->
	</bean>
</beans>