tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harden ZHU" <hard...@sympatico.ca>
Subject JNDI Datasource in Tomcat
Date Mon, 07 May 2001 03:04:07 GMT
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());
        }

    }


Mime
View raw message