spring BasicDataSource 数据源配置 sqlserver数据库 oracle数据库 mysql数据jdbc配置
jdbc.properties 文件信息如下:
----------------------oracle数据库配置 ------------------------------
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:orcl
uname=sys
password=1234
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=100
removeAbandonedTimeout=180
removeAbandoned=true
----------------------mysql 数据库配置 ------------------------------
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/springmvcdb
uname=root
password=1234
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=100
removeAbandonedTimeout=180
removeAbandoned=true
----------------------sqlserver 数据库配置 ------------------------------
driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://localhost:1433;DatabaseName=U9EK0919
uname=SA
password=1234
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=-1
removeAbandonedTimeout=180
removeAbandoned=true
---------------------------------------------------------------------------------
<!-- JNDI获取数据源(使用dbcp连接池) -->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close" scope="singleton">
<property name="driverClassName" value="${driverClassName}"/>
<property name="url" value="${url}"/>
<property name="username" value="${uname}"/>
<property name="password" value="${password}"/>
</bean>