Results 1 to 2 of 2

Thread: Multiple data sources in Spring

  1. #1
    Join Date
    May 2005
    Posts
    1

    Default Multiple data sources in Spring

    Hi
    Is there anyway of configuring multiple data sources under the same session factory or the same transaction manager? I am trying to access 2 oracle databases in 2 different machines. Can anyone provide a sample Spring configuration for such a setup ? All the examples I have seen use a single datasource. There is also a mention to use JTA for multiple data sources. Could someone clarify on this on how to configure using JTA.

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Look at the JPetStore sample application for an example of Spring with JTA. You define a JNDI datasource like this:

    Code:
    <bean id="dataSource" 
       class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName" value="jdbc/jpetstore/">
    </bean>
    And a single JTA transaction manager like this:
    Code:
    <bean id="transactionManager"   
       class="org.springframework.transaction.jta.JtaTransactionManager"/>
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Replies: 3
    Last Post: Dec 27th, 2009, 10:11 PM
  2. Multiple Data Sources
    By UserStephen in forum Data
    Replies: 1
    Last Post: Jul 21st, 2005, 04:58 PM
  3. Multiple Data Sources + Hibernate + Spring
    By joeserel in forum Data
    Replies: 2
    Last Post: May 18th, 2005, 09:22 AM
  4. Replies: 3
    Last Post: Apr 21st, 2005, 03:19 PM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •