Fetching list of DataSources - Websphere

This is a discussion on Fetching list of DataSources - Websphere ; Hi I want to fetch a list of all the DataSources created in the cell, node and server scope in WAS 5.1. I am using the Mbean of type = DataSource for the same. My code also has the functionality ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Fetching list of DataSources

  1. Fetching list of DataSources

    Hi

    I want to fetch a list of all the DataSources created in the cell, node and
    server scope in WAS 5.1. I am using the Mbean of type = DataSource for the
    same.

    My code also has the functionality to create a new data source
    programatically using the JMX Mbean API. The data source gets created and
    its entry gets added to the proper resources.xml file. It also shows up on
    WAS Admin console. However, when I retrieve the list of data sources using
    the DataSource Mbean, the newly added data source does not show up in the
    list.

    This is not a problem with scope. Also, everytime I run the program, I get a
    different list of data sources. Has anybody faced this problem? There is an
    urgent requirement and hence any help will be greatly appreciated. We are
    not able to pin point the problem.

    Thanks & Regards,
    Arati



  2. Re: Fetching list of DataSources

    Arati Rahalkar wrote:

    >Hi
    >
    >I want to fetch a list of all the DataSources created in the cell, node and
    >server scope in WAS 5.1. I am using the Mbean of type = DataSource for the
    >same.
    >
    >My code also has the functionality to create a new data source
    >programatically using the JMX Mbean API. The data source gets created and
    >its entry gets added to the proper resources.xml file. It also shows up on
    >WAS Admin console. However, when I retrieve the list of data sources using
    >the DataSource Mbean, the newly added data source does not show up in the
    >list.
    >
    >This is not a problem with scope. Also, everytime I run the program, I get a
    >different list of data sources. Has anybody faced this problem? There is an
    >urgent requirement and hence any help will be greatly appreciated. We are
    >not able to pin point the problem.
    >
    >Thanks & Regards,
    >Arati
    >
    >
    >
    >

    Arati,
    I've never tried what you're doing, but something you state rang a faint
    bell: I've noticed that some of the DataSource data available through
    JMX is only available if the DataSource has been used. Could this be why
    you're getting inconsistent results?

    Ken

  3. Re: Fetching list of DataSources

    Hi Ken

    Thanks for the reply. But what do you mean by used?

    Earlier I thought may be I am not getting those data sources for which the
    'Test Connection' fails. But that is not the case. I am not getting some of
    the DataSources for which 'Test Connection' fails and some for which it
    succeeds. There is no pattern really.

    Also, the workaround is probably to just directly parse the resources.xml
    file. But then, how do I get a handle to that file? The file is on the
    server where as my code will be running on the client machine.

    Thanks,
    Arati


    "Ken Hygh" wrote in message
    news:d04k9n$5t3i$1@news.boulder.ibm.com...
    > Arati Rahalkar wrote:
    >
    > >Hi
    > >
    > >I want to fetch a list of all the DataSources created in the cell, node

    and
    > >server scope in WAS 5.1. I am using the Mbean of type = DataSource for

    the
    > >same.
    > >
    > >My code also has the functionality to create a new data source
    > >programatically using the JMX Mbean API. The data source gets created and
    > >its entry gets added to the proper resources.xml file. It also shows up

    on
    > >WAS Admin console. However, when I retrieve the list of data sources

    using
    > >the DataSource Mbean, the newly added data source does not show up in the
    > >list.
    > >
    > >This is not a problem with scope. Also, everytime I run the program, I

    get a
    > >different list of data sources. Has anybody faced this problem? There is

    an
    > >urgent requirement and hence any help will be greatly appreciated. We are
    > >not able to pin point the problem.
    > >
    > >Thanks & Regards,
    > >Arati
    > >
    > >
    > >
    > >

    > Arati,
    > I've never tried what you're doing, but something you state rang a faint
    > bell: I've noticed that some of the DataSource data available through
    > JMX is only available if the DataSource has been used. Could this be why
    > you're getting inconsistent results?
    >
    > Ken




  4. Re: Fetching list of DataSources

    Arati Rahalkar wrote:

    >Hi Ken
    >
    >Thanks for the reply. But what do you mean by used?
    >
    >Earlier I thought may be I am not getting those data sources for which the
    >'Test Connection' fails. But that is not the case. I am not getting some of
    >the DataSources for which 'Test Connection' fails and some for which it
    >succeeds. There is no pattern really.
    >
    >Also, the workaround is probably to just directly parse the resources.xml
    >file. But then, how do I get a handle to that file? The file is on the
    >server where as my code will be running on the client machine.
    >
    >Thanks,
    >Arati
    >
    >


    Arati,
    By "used" I mean an application has requested a connection from that
    DataSource and requested data from its database.

    I don't know of a way to directly get to the config's XML files.

    Ken

  5. Re: Fetching list of DataSources

    Hi

    I had been facing difficulty getting a complete list of data sources in WAS.
    But I have found the mistake / solution.

    I was using the queryNames method in AdminClient class to get all the MBeans
    of type=DataSource. But, to access and/or modify configuration data like
    JDBC providers, URL providers, Authentication aliases etc. we should be
    using ConfigService class and the queryConfigObjects method in that class to
    get hold of any configuration data you need.

    Thanks,
    Arati


    "Arati Rahalkar" wrote in message
    news:d06h9u$4tjc$1@news.boulder.ibm.com...
    > Hi Ken
    >
    > Thanks for the reply. But what do you mean by used?
    >
    > Earlier I thought may be I am not getting those data sources for which the
    > 'Test Connection' fails. But that is not the case. I am not getting some

    of
    > the DataSources for which 'Test Connection' fails and some for which it
    > succeeds. There is no pattern really.
    >
    > Also, the workaround is probably to just directly parse the resources.xml
    > file. But then, how do I get a handle to that file? The file is on the
    > server where as my code will be running on the client machine.
    >
    > Thanks,
    > Arati
    >
    >
    > "Ken Hygh" wrote in message
    > news:d04k9n$5t3i$1@news.boulder.ibm.com...
    > > Arati Rahalkar wrote:
    > >
    > > >Hi
    > > >
    > > >I want to fetch a list of all the DataSources created in the cell, node

    > and
    > > >server scope in WAS 5.1. I am using the Mbean of type = DataSource for

    > the
    > > >same.
    > > >
    > > >My code also has the functionality to create a new data source
    > > >programatically using the JMX Mbean API. The data source gets created

    and
    > > >its entry gets added to the proper resources.xml file. It also shows up

    > on
    > > >WAS Admin console. However, when I retrieve the list of data sources

    > using
    > > >the DataSource Mbean, the newly added data source does not show up in

    the
    > > >list.
    > > >
    > > >This is not a problem with scope. Also, everytime I run the program, I

    > get a
    > > >different list of data sources. Has anybody faced this problem? There

    is
    > an
    > > >urgent requirement and hence any help will be greatly appreciated. We

    are
    > > >not able to pin point the problem.
    > > >
    > > >Thanks & Regards,
    > > >Arati
    > > >
    > > >
    > > >
    > > >

    > > Arati,
    > > I've never tried what you're doing, but something you state rang a faint
    > > bell: I've noticed that some of the DataSource data available through
    > > JMX is only available if the DataSource has been used. Could this be why
    > > you're getting inconsistent results?
    > >
    > > Ken

    >
    >




  6. Re: Fetching list of DataSources

    Arati Rahalkar wrote:

    >Hi
    >
    >I had been facing difficulty getting a complete list of data sources in WAS.
    >But I have found the mistake / solution.
    >
    >I was using the queryNames method in AdminClient class to get all the MBeans
    >of type=DataSource. But, to access and/or modify configuration data like
    >JDBC providers, URL providers, Authentication aliases etc. we should be
    >using ConfigService class and the queryConfigObjects method in that class to
    >get hold of any configuration data you need.
    >
    >Thanks,
    >Arati
    >
    >


    Arati,
    Thank you for posting your solution. It's always nice to see people post
    not just their problems, but also what they did that finally resolved them.

    Ken

+ Reply to Thread