tomcat-users mailing list archives

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

Harden,

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 (www.codestudio.com), 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.

Cheers,
E.

>From: "Harden ZHU" <hardenz@sympatico.ca>
>Reply-To: tomcat-user@jakarta.apache.org
>To: <tomcat-user@jakarta.apache.org>
>Subject: JNDI Datasource in Tomcat
>Date: Sun, 6 May 2001 23:04:07 -0400
>
>Hi
>
>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?
>
>Thanks
>
>Harden
>===================================
>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 http://explorer.msn.com


Mime
View raw message