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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to handle multiple database connections with spring?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • 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
  • 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: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
  • Report post to moderator
Please let me know the solutions to do transaction in multiple database simultaneously.
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic