aspose file tools*
The moose likes Spring and the fly likes How to handle multiple database connections with spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply locked New topic
Author

How to handle multiple database connections with spring?

Don boscoo
Greenhorn

Joined: Sep 20, 2010
Posts: 28
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.
pete reisinger
Ranch Hand

Joined: Dec 30, 2009
Posts: 46
check c3p0 - http://www.mchange.com/projects/c3p0/index.html
you'll use it as your dataSource param for session factory
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ramanuj Dev
Greenhorn

Joined: Jul 30, 2009
Posts: 5
Please let me know the solutions to do transaction in multiple database simultaneously.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle multiple database connections with spring?