• 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

Change DB runtime

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
this is my code in applicationcontext.xml and its working fine, my doubt is how to change the DB at run time, In our application we have 4 -5 Databases and user is allowed to change the Db once he/she login

<bean id="placeholderConfigurer"
class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
<property name="location" value="classpath:ryanco.properties"/>
<property name="ignoreUnresolvablePlaceholders" value="true"></property>
</bean>

<!-- ========================= DataSource ========================= -->

<!-- DataSource Definition -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>${db.driverClassName}</value>
</property>
<property name="url">
<value>${db.1.url}</value>
</property>
<property name="username">
<value>${db.1.username}</value>
</property>
<property name="password">
<value>${db.1.password}</value>
</property>
</bean>


this is the code in properties file

db.1.name=Database3
db.1.password=test
db.1.username=test
db.1.driverClassName=oracle.jdbc.driver.OracleDriver
db.1.url=jdbc\ Oracle\:thin\:@10.10.4.3\:1521\ Database3

thanks in advance
[ October 02, 2008: Message edited by: Krishnakumar Ramanathan ]
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a particular error that you are running across or are you not sure where to start on solving this problem?
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you are using Spring Framework, so better post this in Application Framework section.

Cant help you much cause I don't know Spring !
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic