tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "eric chacon" <>
Subject Re: JNDI Datasource in Tomcat
Date Mon, 07 May 2001 03:12:19 GMT


You'll need some connection pooling software which doesn't appear to come 
bundled with Tomcat.  There are several open-source connection pools.

I've used PoolMan (, and found it to work pretty well.

I did have a problem using JNDI, which I never successfully resolved, 
however:  to make a Datasource (or any object) available through JNDI, you 
need to set up a proper security policy.  I was never able to deploy a 
datasource that my servlets could read.

Most connection pooling software packages don't require that you use JNDI 
(they come with propietary configuration files and such).

Note: If you use a full J2EE solution such as Enhydra or JBoss (both of 
which come bundled with Tomcat), then they'll set up your data sources for 
you (you modify some XML files), and you're good to go.


>From: "Harden ZHU" <>
>To: <>
>Subject: JNDI Datasource in Tomcat
>Date: Sun, 6 May 2001 23:04:07 -0400
>I try to use JNDI to get datasource in tomcat. How can I config a jndi
>datasource in
>tomcat so i can get datasource as follow code?
>public AttributeDAO(String dataSource)  throws AttributeDAOException {
>         try {
>             InitialContext ic = new InitialContext();
>             datasource = (DataSource) ic.lookup(dataSource);
>         } catch (NamingException ne) {
>             throw new AttributeDAOException("NamingException while looking 
>                             "up DB context  : " + ne.getMessage());
>         }
>     }

Get your FREE download of MSN Explorer at

View raw message