code: public static Statement open(String jndiPath) {
      try {
        Context ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup(jndiPath);
        Connection conn = ds.getConnection();
        return conn.createStatement();
      } catch (NamingException e) {
        throw new DukeException("No database configuration found via JNDI at " +
                                jndiPath, e);
      } catch (SQLException e) {
        throw new DukeException("Error connecting to database via " +
                                jndiPath, e);
      }
    }
docs: Get a configured database connection via JNDI.