4 Replies Latest reply on Aug 5, 2003 6:59 AM by juhalindfors

    Dynamically adding a new datasource

    raghurv

      Hi,

      I am using JBoss 3.2.1 and i would like to know whether it is possible to create a datasource dynamically?

      thanks in advance
      raghu

        • 1. Re: Dynamically adding a new datasource
          jonlee

          Programmatically, I don't think it is an easy task. The interfaces were not designed for the purpose. However, someone might have better insight into this.

          I suppose one way you could achieve this is by creating a process to write and deploy a *-ds.xml. However, since deployment is asynchronous there are issues such as blocking until the DS is deployed and instantiated.

          • 2. Re: Dynamically adding a new datasource
            101

            hmm... how fool i am. i was trying to package my *.rar and my *-ds.xml into an ear and deploy it all at once. from your post it seems like it's impossible, or at least not reasonable...

            but if i deploy my *-ds.xml, what is the connection between the datasource and the resource adapter in my .rar? is it the JNDI name you mentioned in you previous post? btw, do you have some example you could paste?

            thanks all,

            - 101

            • 3. Re: Dynamically adding a new datasource
              101

              oops, i've read the JNDI thing in a different thread... here it is for reference:

              Have you updated the "standardjbosscmp-jdbc.xml" file (found in Jboss install dir\server\your server\conf) with the following line?
              java:/TEST

              • 4. Re: Dynamically adding a new datasource

                You should be able to package your RAR and datasource.xml into a SAR archive.

                -- Juha