I am using jdbc connection pooling and i am getting the connection more than 100 place in the web application. how can i write the common code in single class and call, where required.
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/UserDB");
Connection con = ds.getConnection();