wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes using 2 databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "using 2 databases" Watch "using 2 databases" New topic

using 2 databases

Renata fonseca
Ranch Hand

Joined: Mar 15, 2002
Posts: 48
Hi all
I have to update 2 databases at same time... how can I persist an entity bean into two different databases (ie: Db2 and SQL Server)?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Some options:
1) Use a BMP entity bean
2) Use your EJB container's proprietary features (not likely to exist)
3) Use a special JDBC driver, which can do the update on two databases (don't know if such drivers exist)

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
How about use two different beans?

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
subject: using 2 databases