4 Replies Latest reply on Jun 20, 2003 3:09 PM by jfradkin

    JDBC JNDI List

    Ray Harrison Newbie

      Hello,
      I am interested in programatically obtaining the list of jdbc data sources bound to the JNDI tree. What's the best way to achieve this?

      Thanks
      Ray

        • 1. Re: JDBC JNDI List
          Jon Barnett Master

          Haven't had a good look at this, but probably you should look at the jmx-console code as it displays, amongst other things, details about datasources.

          • 2. Re: JDBC JNDI List
            Ray Harrison Newbie

            Thanks! I'll have a look...
            Cheers
            Ray

            • 3. Re: JDBC JNDI List
              Ray Harrison Newbie

              That worked brilliantly - thanks for the insight....

              Cheers
              Ray

              • 4. Re: JDBC JNDI List
                jfradkin Newbie

                I am having an issue that relates.
                I did have my JNDI lookup working fine using
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("java:/Drive");
                con = ds.getConnection();

                Now it says it is not bound. I am too new to understand it. I look on the console and see
                what is listed below. I see Drive but can no longer look it up.

                Maybe you guys can point me in the right direction.

                from eclipse: when erroring
                javax.naming.NameNotFoundException: Drive not bound
                at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
                at sun.rmi.transport.Transport$1.run(Transport.java:148)
                at java.security.AccessController.doPrivileged(Native Method)
                at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                at java.lang.Thread.run(Thread.java:536)
                at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
                at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)Exception in main: Drive not bound

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
                at javax.naming.InitialContext.lookup(InitialContext.java:347)
                at jndi_test.main(jndi_test.java:31)


                from console:

                java:

                SecurityProxyFactory
                org.jboss.security.SubjectSecurityProxyFactory


                DefaultJMSProvider
                org.jboss.jms.jndi.JBossMQProvider


                comp
                javax.naming.Context


                JmsXA
                org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl


                jaas
                javax.naming.Context

                JmsXARealm
                org.jboss.security.plugins.SecurityDomainContext



                timedCacheFactory
                javax.naming.Context

                Failed to list contents of: timedCacheFactory, errmsg=null



                Drive
                org.jboss.resource.adapter.jdbc.WrapperDataSource