Hi,
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;
try
{
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
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)
{
e.printStackTrace();
}
}
}
Stacktrace shows:
javax.naming.NameNotFoundException: Name java: is not bound in this Context
at org.apache.naming.NamingContext.list(NamingContext.java:344)
at org.apache.naming.NamingContext.list(NamingContext.java:367)
at javax.naming.InitialContext.list(InitialContext.java:387)
What am I doing wrong? Is it allowed to access the Pool from remote client in
first place?
Thanks in advance,
Appa
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com