Announcement Announcement Module
Collapse
No announcement yet.
Using 2 or more databases Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using 2 or more databases

    I have a databases which references rows to another database. Using them both in transactions and such is easy. The ugly part is displaying data from both databases. Currently I have to create a 'Helper' bean which can hold the merged data from both databases.

    While this works, its kind of ugly since I can't use an O/R mapping. Does anyone have any other suggestions besides creating a Helper bean and merging the data?

    Thanks

  • #2
    If your database is Oracle, you can use DBLinks from db1 to db2. The application can then talk to db1.
    HTH

    Comment


    • #3
      This thread discusses an approach for accessing two or more independent data sources in one application. In summary, you can create a BeanFactory per unique data source.

      http://forum.springframework.org/sho...538&highlight=
      Last edited by robyn; May 19th, 2006, 06:31 AM.

      Comment


      • #4
        Hmm that gives me an idea...

        I can inject Database1's DAO into a Bean of Database2

        Then in the bean of DB2 I can just do getBeanOfDB1 (accessing DB1's DAO) and this will make everything work transparently.

        Although this breaks a lot of rules since there is a DAO being used inside a bean.

        Or maybe I can do something aspect oriented, when getBeanOfDB1 is called have an interceptor inject the bean into the current DB2's bean.

        Thoughts?

        Comment

        Working...
        X