xmlé
ç½®æ件ä¸é
ç½®å¦ä¸ï¼
Java代ç æ¶è代ç
<spring:bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="locations">
<spring:list>
<spring:value>classpath:conf/jdbc.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
<spring:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<spring:property name="driverClassName"
value="${jdbc.driverClassName}" />
<spring:property name="url"
value="${jdbc.url}" />
<spring:property name="username" value="${jdbc.username}" />
<spring:property name="password" value="${jdbc.password}" />
<spring:property name="maxActive" value="30" />
<spring:property name="maxIdle" value="10" />
<spring:property name="maxWait" value="1000" />
<spring:property name="defaultAutoCommit" value="true" />
</spring:bean>
jdbc.propertiesé
ç½®æ件ä¸è¿æ¥æ°æ®åºé
ç½®ï¼
Java代ç æ¶è代ç
#sqlserveræ°æ®æºé
ç½®
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://192.168.1.60:1408;DatabaseName=test
jdbc.username=sa
jdbc.password=1
#mysqlæ°æ®æºé
ç½®
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.1.60:3306/test
jdbc.username=root
jdbc.password=root
#Oracleæ°æ®æºé
ç½®
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@10.60.17.9:1521:orcl
jdbc.username=admin
jdbc.password=admin
温馨提示:内容为网友见解,仅供参考