File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Change DB runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Change DB runtime" Watch "Change DB runtime" New topic

Change DB runtime

Krishnakumar Ramanathan

Joined: Aug 04, 2008
Posts: 6
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"
<property name="location" value=""/>
<property name="ignoreUnresolvablePlaceholders" value="true"></property>

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

<!-- DataSource Definition -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<property name="url">
<property name="username">
<property name="password">

this is the code in properties file
db.1.url=jdbc\ Oracle\:thin\:@\:1521\ Database3

thanks in advance
[ October 02, 2008: Message edited by: Krishnakumar Ramanathan ]
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Is there a particular error that you are running across or are you not sure where to start on solving this problem?

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904

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 !

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
I agree. Here's the link:
subject: Change DB runtime
jQuery in Action, 3rd edition