File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 for other WebSphere information.
I agree. Here's the link:
subject: using 2 databases
It's not a secret anymore!