Tuesday, September 23, 2008

Tomcat datasource connection pooling
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Non%20DBCP%20Solutions


private static void initializeDataSource(String whichOne) throws NamingException, SQLException{
logger.debug("entering initializeDataSource("+whichOne+")");

try{
InitialContext ic = new InitialContext();

if(whichOne.equals(AppHelper.SC_DEFAULT_DS_CON)){
//if (dataSource == null)
dataSource = (DataSource) ic.lookup(whichOne);
}
}catch (NamingException ne){
throw new NamingException("NamingException while looking" +
" up DataSource Connection " + whichOne
+ ": \n" + ne.getMessage());
}
logger.debug("leaving initializeDataSource()");
}

No comments: