新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
Spring整合多數(shù)據(jù)源實(shí)現(xiàn)動(dòng)態(tài)切換的實(shí)例講解-創(chuàng)新互聯(lián)
在實(shí)際項(xiàng)目中時(shí)常需要連接多個(gè)數(shù)據(jù)庫(kù),而且不同的業(yè)務(wù)需求在實(shí)現(xiàn)過(guò)程當(dāng)中往往需要訪問(wèn)不同的數(shù)據(jù)庫(kù)。
jdbc.properties配置文件,配置多個(gè)dataSource
##########################MySQL##################################### hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect connection.driver_class=com.mysql.jdbc.Driver connection.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8 connection.username=yahu connection.password=123456 ##########################Oracle##################################### connection1.driver_class=oracle.jdbc.driver.OracleDriver connection1.url=jdbc\:oracle\:thin\:@localhost\:1521/MEDB connection1.username=yahu connection1.password=123456 ##########################Sql Server2008##################################### connection2.driver_class=net.sourceforge.jtds.jdbc.Driver connection2.url=jdbc:jtds:sqlserver://localhost:1433;DatabaseName=test connection2.username=yahu connection2.password=123456
當(dāng)前題目:Spring整合多數(shù)據(jù)源實(shí)現(xiàn)動(dòng)態(tài)切換的實(shí)例講解-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://www.ef60e0e.cn/article/cdoohi.html