[Java] Read DataSource From Connection Pool (Tomcat And WAS4)
Join the DZone community and get the full member experience.
Join For Free
Context initContext;
initContext = new InitialContext();
DataSource ds = null;
if ("TOMCAT".equals(appServer)) {
//Apache Tomcat Server
ds = (DataSource)initContext.lookup("java:comp/env/jdbc/yourJNDI");
} else if ("WAS4".equals(appServer)) {
//IBM WebSphere 4.x
ds = (DataSource)initContext.lookup("jdbc/yourJNDI");
}
Connection pool
Datasource
Connection (dance)
Opinions expressed by DZone contributors are their own.
Comments