2 Replies Latest reply on Apr 27, 2004 4:20 AM by Sumedh

    Setting resource-refs at run-time

    Sumedh Newbie

      Hi all,

      I want to know how to set resource-refs at run-time...I actually want to set JDBC datasources (javax.sql.DataSource) at runtime...

      Is this posisble at all?

      Thanks...

        • 1. Re: Setting resource-refs at run-time
          Adrian Brock Master

          Only if you use the alias mbean

          resource-ref -> alias -> datasource

          I don't like the idea of changing datasource halfway through a transaction.

          • 2. Re: Setting resource-refs at run-time
            Sumedh Newbie

            Actually I dont mind setting the JDBC source before the component is deployed, but I want to set the "resource params" at run-time, based on the values entered via a UI.

             <Resource name="jdbc/test" type="javax.sql.DataSource" auth="SERVLET"/>
             <ResourceParams name="jdbc/test">
             <parameter>
             <name>driverClassName</name>
             <value>oracle.jdbc.driver.OracleDriver</value>
             </parameter>
             <parameter>
             <name>url</name>
             <value>jdbc:oracle:thin:@sumedh:1521:sumedh</value>
             </parameter>
             <parameter>
             <name>username</name>
             <value>sumedh3</value>
             </parameter>
             <parameter>
             <name>password</name>
             <value>ADD7 A78C 3020 9D66 36B5 10D 5FCD 689B 5761</value>
             </parameter>
             </ResourceParams>
            


            The above is how it is set in a Tomcat 5 XML descriptor.
            According to the above snippet, i want to set the "resourceparams" at run time, but have not found something equivalent in JBoss.

            Can you help me?

            Thanks...