1 Reply Latest reply on Oct 31, 2001 7:04 PM by davidjencks

    connection pool help

    ayakubovich

      Hi.
      I'm trying to configure connection pool for my sql. Looks like everything is right,
      but at the end I cannot get my DataSource reference from JNDI tree.
      Here are all my settings and everything I do to get that reference.
      I Appreciate any input
      Thank you
      Alexi

      1) Here is jboss.jcml entry for connection pool


      org.gjt.mm.mysql.Driver



      jdbc/mysql
      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl
      jdbc:mysql://localhost:3306/mydb
      root
      admin


      2) Here is what I get when jboss starts:

      [JDBC provider] Starting
      [JDBC provider] Started
      [jdbc\mysql] Starting
      [jdbc\mysql] XA Connection pool jdbc\mysql bound to java:/jdbc/mysql
      [jdbc\mysql] Started



      3) Here is the code I’m using to get datasource. I run it on different JVM (other than Jboss one)

      InitialContext env = getInitialContext();

      DataSource dso = (DataSource) env.lookup("java:/jdbc/mysql");
      System.out.println("Class ds: " + dso.getClass().toString());

      static public InitialContext getInitialContext() throws Exception {
      java.util.Hashtable h = new Properties();
      h.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      h.put(Context.PROVIDER_URL,"localhost:1099");
      h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

      InitialContext ctx = new javax.naming.InitialContext(h);
      return ctx;
      }



      4) and here what I get.

      avax.naming.NameNotFoundException: jdbc not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:473)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:481)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:487)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at com.precise.test.DBAccess.getConnectionFromPool(DBAccess.java:103)


      Please Help

        • 1. Re: connection pool help
          davidjencks

          As stated in numerous replies to this question, you cannot access a datasource outside the vm in which it is created. That is one reason it is bound in the private invisible to the outside world java: namespace.