Author
How to handle multiple database connections with spring?
Don boscoo
Greenhorn
Joined: Sep 20, 2010
Posts: 28
posted Mar 03, 2011 08:24:55
0
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
posted Mar 03, 2011 15:24:55
0
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: 17243
posted Mar 04, 2011 14:26:55
0
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
posted Oct 22, 2012 05:08:27
0
Please let me know the solutions to do transaction in multiple database simultaneously.
Mark Spritzler
ranger
Sheriff
Joined: Feb 05, 2001
Posts: 17243
posted Oct 22, 2012 11:37:05
0
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
subject: How to handle multiple database connections with spring?