Checking presence of JNDI name for a DataSource - Websphere

This is a discussion on Checking presence of JNDI name for a DataSource - Websphere ; Hi I need to check whether a DataSource is already registered in the Websphere namespace under a specified JNDI name. I am able to look up for the given JNDI name using the lookup method in InitialContext. My problem is ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Checking presence of JNDI name for a DataSource

  1. Checking presence of JNDI name for a DataSource

    Hi

    I need to check whether a DataSource is already registered in the Websphere
    namespace under a specified JNDI name. I am able to look up for the given
    JNDI name using the lookup method in InitialContext.

    My problem is that the object returned by the lookup method is of type
    javax.naming.Reference. I need to verify whether this JNDI name refers to a
    DataSource and make sure that it is not a JMS Provider or a URL Provider.
    However, the Reference class does not give me any such information.

    Please help.

    Thanks,
    Arati



  2. Re: Checking presence of JNDI name for a DataSource

    lookup returns type Object, not type Reference. You could do an instanceof
    to see if it is a DataSource, and also
    adopt a binding naming convention which would give you a clue ?

    Dave

    "Arati Rahalkar" wrote in message
    news:d08vsj$6jtk$1@news.boulder.ibm.com...
    > Hi
    >
    > I need to check whether a DataSource is already registered in the

    Websphere
    > namespace under a specified JNDI name. I am able to look up for the given
    > JNDI name using the lookup method in InitialContext.
    >
    > My problem is that the object returned by the lookup method is of type
    > javax.naming.Reference. I need to verify whether this JNDI name refers to

    a
    > DataSource and make sure that it is not a JMS Provider or a URL Provider.
    > However, the Reference class does not give me any such information.
    >
    > Please help.
    >
    > Thanks,
    > Arati
    >
    >




  3. Re: Checking presence of JNDI name for a DataSource

    Hi

    Yes, but that Object is of type Reference. Not DataSource, so it will give
    me a ClassCastException. And, I cannot depend upon just the naming
    convention. I am not understanding why I am not getting a DataSource type of
    Object and getting a javax.naming.Reference object?

    Thanks,
    Arati

    "Dave Milne" wrote in message
    news:d0925v$4jlc$1@news.boulder.ibm.com...
    > lookup returns type Object, not type Reference. You could do an instanceof
    > to see if it is a DataSource, and also
    > adopt a binding naming convention which would give you a clue ?
    >
    > Dave
    >
    > "Arati Rahalkar" wrote in message
    > news:d08vsj$6jtk$1@news.boulder.ibm.com...
    > > Hi
    > >
    > > I need to check whether a DataSource is already registered in the

    > Websphere
    > > namespace under a specified JNDI name. I am able to look up for the

    given
    > > JNDI name using the lookup method in InitialContext.
    > >
    > > My problem is that the object returned by the lookup method is of type
    > > javax.naming.Reference. I need to verify whether this JNDI name refers

    to
    > a
    > > DataSource and make sure that it is not a JMS Provider or a URL

    Provider.
    > > However, the Reference class does not give me any such information.
    > >
    > > Please help.
    > >
    > > Thanks,
    > > Arati
    > >
    > >

    >
    >




  4. Re: Checking presence of JNDI name for a DataSource

    I don't know what you are looking up, but lookup does return type Object and
    you can use the instanceof / getClass method to find out what it is. If
    you are getting back a Reference object when you are expecting a DataSource
    object, that's a different question. Reference is a reference to an object
    that is found outside of the naming/directory system. I think, but am not
    100% sure about this, that you can get back a reference object instead of
    the bound object if the factory class cannot be seen by JNDI.

    Dave

    "Arati Rahalkar" wrote in message
    news:d096go$4sgu$1@news.boulder.ibm.com...
    > Hi
    >
    > Yes, but that Object is of type Reference. Not DataSource, so it will give
    > me a ClassCastException. And, I cannot depend upon just the naming
    > convention. I am not understanding why I am not getting a DataSource type

    of
    > Object and getting a javax.naming.Reference object?
    >
    > Thanks,
    > Arati
    >
    > "Dave Milne" wrote in message
    > news:d0925v$4jlc$1@news.boulder.ibm.com...
    > > lookup returns type Object, not type Reference. You could do an

    instanceof
    > > to see if it is a DataSource, and also
    > > adopt a binding naming convention which would give you a clue ?
    > >
    > > Dave
    > >
    > > "Arati Rahalkar" wrote in message
    > > news:d08vsj$6jtk$1@news.boulder.ibm.com...
    > > > Hi
    > > >
    > > > I need to check whether a DataSource is already registered in the

    > > Websphere
    > > > namespace under a specified JNDI name. I am able to look up for the

    > given
    > > > JNDI name using the lookup method in InitialContext.
    > > >
    > > > My problem is that the object returned by the lookup method is of type
    > > > javax.naming.Reference. I need to verify whether this JNDI name refers

    > to
    > > a
    > > > DataSource and make sure that it is not a JMS Provider or a URL

    > Provider.
    > > > However, the Reference class does not give me any such information.
    > > >
    > > > Please help.
    > > >
    > > > Thanks,
    > > > Arati
    > > >
    > > >

    > >
    > >

    >
    >




+ Reply to Thread