Can pass two ways
1 Add in Add in the XML of Conf / Catalina / LocalHost Add Web.xml in project web-infers 2 is also added in host> in Server.xml Context> Add Web.xml in project web-infers <% @ page import = "java.sql. *"%> <% @ page import = "javax.sql. *"%> <% @ page import = "javax.naming. *"%> <% datasource ds = null; try {InitialContext ctx = new InitialContext (); ds = (DataSource) ctx.lookup ( "java: comp / env / jdbc / TestDB"); Connection conn = ds.getConnection (); Statement stmt = conn.createStatement ( ); String strsql = "select * from authors"; ResultSet RS = stmt.executeQuery (strsql); while (rs.next ()) {Out.println (rs.getstring (1));}} Catch (Exception EX) {OUT.PRINT (EX); EX.PrintStackTrace ();}%> in conclusion: Carefully watch the documentation