Announcement Announcement Module
Collapse
No announcement yet.
HotSwappableTargetSource and multiple users Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HotSwappableTargetSource and multiple users

    Hi there ,
    I implemented some functionality that use HotSwappableTargetSource to switch from multiple datasources . The problem is when user1 goes into application he will use dataSource1 for finding some data .When user2 goes into application he will use dataSource2 to find some data , and I have only swappable target datasource , then when the user1 will try to made a new search he will find the datasource swap to datasource2 which is not good .
    How can I bound the datasource used from the user session?
    Also when I try use a Jndi like this a swappable data source can't be bound because some exception will be raised.
    Any hints or adviceses are really apreciated .
    Best regards ,
    Stefan

    <!--bean id="dataSourceCentral"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>jdbc/qbankDSCentral</value>
    </property>
    </bean-->


    My configuration is like this :
    <bean id="dataSource1" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"><value>com.informix.jdbc.If xDriver</value></property>
    <property name="url"><value>jdbc:informix-sqli://1xx:1610/bd1:INFORMIXSERVER=qbank</value></property>
    <property name="username"><value>xx</value></property>
    <property name="password"><value>xx</value></property>
    </bean>


    <bean id="dataSource2" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"><value>com.informix.jdbc.If xDriver</value></property>
    .....
    </bean>


    <bean id="swappingDataSourceTargetSource" class="org.springframework.aop.target.HotSwappable TargetSource">
    <constructor-arg>
    <ref bean="dataSourceBV"/>
    </constructor-arg>
    </bean>



    <bean id="dataSource" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="targetSource" ref="swappingDataSourceTargetSource"/>
    </bean>
Working...
X