Discussions

EJB design: Accessing two different database

  1. Accessing two different database (4 messages)

    Hi, if an application requires access to two different database for all its operations, like an operation will first check for the data in one database, and if it does not exist it will check in the second db, what will be the best design strategy? or do we have a pattern for this kind of problems? I know that, we have to do a datasource switching, But as all the operations requires this check, what will be the optimum, scalable way to do this?

    Threaded Messages (4)

  2. Hi, if an application requires access to two different database for all its operations, like an operation will first check for the data in one database, and if it does not exist it will check in the second db, what will be the best design strategy? or do we have a pattern for this kind of problems?

    I know that, we have to do a datasource switching, But as all the operations requires this check, what will be the optimum, scalable way to do this?
    Yes, it's called the "Accessing two different database" pattern. You can find it at AccessingTwoDifferentDatabase.com
  3. @Race Condition[ Go to top ]

    not able to open/get the site u have stated.. can u post a link?
  4. connection pool for two database[ Go to top ]

    every request checks the db will waste time you can create a db pool for the two db it must be keep every connection is valid
  5. well, I know of no nifty little pattern for this. I assume using a JEE 5 Server, and JPA(Java Persistence Architecture), or JPA by itself. Well I sense a Finder Method calling a JPA Named Query to two different Persistence Units attached to two different data sources. I assume this was your default implementation. If there is a way in which the databases may be linked. I believe Sybase had this functionality to link two databases as a virtual database, and access both database's through Query Views, would be better. pending you have a database that supports this. This also puts more dependency in you database vendor to handle that connection and configuration, so there are no great answers. - best of Luck. Tony McClay