2 Replies Latest reply on Apr 15, 2003 3:11 PM by malian

    need help connecting 2 database

    malian Newbie

      I am trying to use jboss jca to connect to 2 postgresql databases. Both database are on the same database server, lets call it db1 and db2. How can I setup postgres-service.xml to configure those 2 database? db1 holds entity beans and db2 is a custom dabase. How can I get a pooled db2 connection in a client application? I couldn't find any sample code on how to do this. I would appreciate any help!

      Thank you,
      Malia

        • 1. Re: need help connecting 2 database
          David Jencks Master

          If you are using 3.0.x, you will have a *-service.xml file for the first db. Add another copy of the mbean configurations to that file and change the mbean names and the jndi name (and the url:-)

          If you are using 3.2, you will have a *-ds.xml file. Copy the local-tx-datasource element and change the jndi-name (and url).

          If you want you can have 2 separate files.

          • 2. Re: need help connecting 2 database
            malian Newbie

            Thank you for your help. I configured the 2 datasource correctly as you suggested, but the problem is that I am accessing those datasource outside of the jboss environment. I am acessing it through classes in a web context of tomcat. I found out that jboss doesn't allow datasource connection from classes external to its vm, which is inconvenient, but ok, since tomcat does database pooling as well. I used tomcat's pooling and for anyone else trying to do the same thing, go to apache's site and look for datasource configuration documentation. Thanks again for your reply!
            -Malia