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

How to handle multiple database connections with spring?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi All,

How to setup multiple database connections in spring simultaneously? How to configure it in app-config.xml ? Can someone tell me the best practise to do it?

Thanks.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
check c3p0 - http://www.mchange.com/projects/c3p0/index.html
you'll use it as your dataSource param for session factory
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I actually don't think the poster meant a Connection Pool, but more that they have more than one database that they need to talk with.

Each Database will needs its own DataSource, and Data Access Technology bean class needed (ie SessionFactory, JdbcTemplate, EntityManagerFactory)

If you do not have a JTA Transaction manager that does two phase XA commits, then you will need a transaction manager for each database too.

Mark
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please let me know the solutions to do transaction in multiple database simultaneously.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Ramanuj Dev wrote:Please let me know the solutions to do transaction in multiple database simultaneously.



Please don't duplicate post. This is an older thread and therefore probably won't get a new asnwer to it, so I am going to close it so it doesn't get resurrected again.

Thanks

Mark
 
    Bookmark Topic Watch Topic
  • New Topic