4 Replies Latest reply on Jun 25, 2008 5:43 PM by sankul123

    how to get the value of a property in oracle-ds.xml from my

    hms

      Hi,

      In oracle-ds.xml, my application wanna read its value and do some biz logic, so how could I get the value of those properties?

      for example
      <connection-url>
      <user-name>

      etc..

      Thanks for any input,

      hms

        • 1. Re: how to get the value of a property in oracle-ds.xml from
          weston.price

          Currently there is no way to do this from the JDBC api. You could probably call

          getUnderlyingConnection() on the connection retrieved from the DataSource, but you would have to cast it to the appropriate type. In this case, Oracle.

          At that point, the underlying OracleConnection would have to provide a way to retrieve underlying properties.

          The other way to do it would be via JMX and query the ConnectionFactory for the particular attribute you are interested in reading. Easiest way to do it would be to proxy the underlying RARDeployment MBean and execute the getManagedConnectionFactoryAttribute() operation.

          Finally, you could always just read the *-ds.xml file using JAXP and look for the property you want.

          • 2. Re: how to get the value of a property in oracle-ds.xml from
            hms

            Hi,

            Price, thanks for your answering,

            I just found an easy way to do it,

            String url = connection.getMetaData().getUrl();


            hms

            • 3. Re: how to get the value of a property in oracle-ds.xml from
              weston.price

              Correct.

              Your initial post seemed like you wanted to do this prior to making a connection to the DB, as if you wanted to perform some logic prior to making a connection.

              • 4. Re: how to get the value of a property in oracle-ds.xml from
                sankul123

                Hi Price,

                Is there any Jboss API through JMX , from which we can update the connection parameters already set in ds.xml and get conn object according to new set connection parameters.

                Regards,
                Sandeep