• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Configuration of 2 Databases using spring

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic