I am trying to implement data pooling in a Tomcat7
container. My understanding is I have to use the following code to retrieve a data connection
Context initContext;
DataSource datasource = null;
try {
initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env");
datasource = (DataSource) envContext.lookup("jdbc/bolsms");
} catch (NamingException ex) {
Logger.getLogger(ReceiveC2DMRegistration.class.getName()).log(Level.SEVERE, null, ex);
}
My Question
For Context
do I have to import javax.naming.context
or org.apache.catalina.Context
and for DataSource
do I have to import javax.sql.DataSource
or org.apache.tomcat.jdbc.pool.DataSource
?