2 Replies Latest reply on May 17, 2002 11:58 PM by David Jencks

    Getting Connection from Connection Pool

    ankur kumar Newbie

      I'm using JBoss 3.0 and mysql as a database server. I created connection pool using mysql-service.xml and it's working fine with my EJBs.

      But I want to get connection from connection pool in a JSP and it says that "NameNotFoundException" whereas the same thing is working in EJBs. Here is code:

      Properties p = new Properties();
      p.putContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
      InitialContext initCtx = new javax.naming.InitialContext(p);
      DataSource ds = (javax.sql.DataSource)initCtx.lookup("java:comp/env/jdbc/DefaultDS");
      Connection con = ds.getConnection();