| Author |
Configuration of 2 Databases using spring
|
Sahil Saxena
Greenhorn
Joined: May 26, 2005
Posts: 22
|
|
Hi, I have 2 databases db1 and db2 both installed on same postgres server. How should i configure both of them in applicationContext.xml? I am using hibernate and spring combination. - db1 is already confiured in applicationContext as below <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>org.postgresql.Driver</value> </property> <property name="url"> <value>jdbc ostgresql://1.1.1.1:5432/db1</value> </property> <property name="username"> <value>postgres</value> </property> <property name="password"> <value>postgres</value> </property> </bean> Should i create one more datasource in applicationContext.xml??? Thanks [ February 07, 2006: Message edited by: Sahil Saxena ]
|
SCJP 1.4 & SCWCD
|
 |
Michael Duffy
Ranch Hand
Joined: Oct 15, 2005
Posts: 163
|
|
Originally posted by Sahil Saxena: Hi, I have 2 databases db1 and db2 both installed on same postgres server. How should i configure both of them in applicationContext.xml? I am using hibernate and spring combination. - db1 is already confiured in applicationContext as below <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>org.postgresql.Driver</value> </property> <property name="url"> <value>jdbc ostgresql://1.1.1.1:5432/db1</value> </property> <property name="username"> <value>postgres</value> </property> <property name="password"> <value>postgres</value> </property> </bean> Should i create one more datasource in applicationContext.xml??? Thanks [ February 07, 2006: Message edited by: Sahil Saxena ]
Yes. Give them different ids, and then inject them into the objects that need them.
|
%
|
 |
 |
|
|
subject: Configuration of 2 Databases using spring
|
|
|