tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From appa rao <>
Subject [OT] : How to get a connection from Tomcat DBCP from a remote application?
Date Mon, 02 May 2005 00:46:22 GMT

I am using Tomcat 5.5.7 and configured DBCP properly to work with Oracle 9i.
Everything is working fine if I try to get the connection from the Pool from an application
deployed in Tomcat.
However if I try to get the connection from the Pool from an application which is not deployed
in Tomcat (remote client), I am getting not bound exceptions.
Here is the code:
import java.util.*;
import javax.naming.*;
import javax.sql.DataSource;
public class  ClientTest
 public static void main(String[] args) 
  Context ctx = null;
   Hashtable props = new Hashtable();
   props.put(Context.INITIAL_CONTEXT_FACTORY, "");
   props.put(Context.URL_PKG_PREFIXES, "org.apache.catalina.util.naming");
   ctx = new InitialContext(props);
   DataSource dataSource = (DataSource)ctx.lookup("java:/comp/env/jdbc/test");
  catch(Exception e)
Stacktrace shows:
javax.naming.NameNotFoundException: Name java: is not bound in this Context
        at org.apache.naming.NamingContext.list(
        at org.apache.naming.NamingContext.list(
        at javax.naming.InitialContext.list(
What am I doing wrong?  Is it allowed to access the Pool from remote client in first place?
Thanks in advance,

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message