如何在一个WEB程序里同时连接多个数据库
展开全部
我这个事连接MYSQL和ORACLE的,看看对你有没有帮助:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<!-- <value>jdbc:mysql://193.168.4.2:3306/consumer?useUnicode=true&characterEncoding=utf-8&autoReconnect=true</value> -->
<value>jdbc:mysql://193.168.1.200:3306/consume?useUnicode=true&characterEncoding=utf-8&autoReconnect=true</value>
</property>
<property name="username">
<value>root</value>
</property>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<!-- <value>jdbc:mysql://193.168.4.2:3306/consumer?useUnicode=true&characterEncoding=utf-8&autoReconnect=true</value> -->
<value>jdbc:mysql://193.168.1.200:3306/consume?useUnicode=true&characterEncoding=utf-8&autoReconnect=true</value>
</property>
<property name="username">
<value>root</value>
</property>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询