Tomcat server.xml
source
Context web.xml
DB Connection jdbc/mysqlConn javax.sql.DataSource Container
source
Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/mysqlConn"); // 설정정보의 name과 동일하게 셋팅 // 커넥션 얻기 Connection con = ds.getConnection();