1. 程式人生 > >spring jdbc連線池的配置

spring jdbc連線池的配置

ORACLE

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"

destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url"
value="jdbc:oracle:thin:@192.168.32.82:1521:rszx1" />
<property name="username" value="system" />
<property name="password" value="byht" />

</bean>

MYSQL

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://192.168.32.19:3306/wake?useUnicode=true&amp;characterEncoding=UTF-8" />
<property name="url" value="jdbc:mysql://localhost:3306/cxrs_wake?useUnicode=true&amp;characterEncoding=UTF-8" />
<property name="username" value="root" />
<property name="password" value="byht" />
</bean> 

SQLSERVER

 <bean id="dataSource" 
 class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
 <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> 
 <property name="url" 
 value="jdbc:sqlserver://192.168.32.13:1433;databaseName=dxhbms2" /> 
 <property name="username" value="sa" /> 
 <property name="password" value="123abc!" /> 
 </bean>  

<!-- 目標資料庫型別 -->
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform"/> 
<!--<property name="databasePlatform" value="org.eclipse.persistence.platform.database.SQLServerPlatform"/> -->
<!--<property name="databasePlatform" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform" /> -->
</bean>
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />