1, the JAR file required: commons-pool.jar, commons-dbcp.jar
2, Server.xml configuration:
Context ctx = new initialContext (); if (ctx == null) throw new exception ("Boom - No Context");
DataSource DS = (Datasource) CTX.lookup ("java: comp / env / jdbc / hellohibernate");
IF (ds! = null) {connection conn = ds.getConnection ();
IF (conn! = null) {foo = "got connection" conn.tostring (); statement stmt = conn.createstatement (); resultset = stmt.executeQuery ("SELECT Username, ID from user"; if (RST) .next ()) {foo = rst.getstring (1); bar = Rst.Getint (2);} conn.close ();}}