资料内容:
Remarks
Utilizing JNDI and JDBC also affords you to use ORMs like Hibernate or platforms like JPA to
define "persistence units" for object and table mapp
Examples
Configuring a server-wide JNDI reference
Inside of your {CATALINA_HOME}/conf/ folder exists a server.xml and context.xml file. Each one of
these contains similar code, but references different parts of Tomcat to complete the same
task.
server.xml is server-wide configuration. This is where you can set up HTTPS, HTTP2, JNDI
Resources, etc.
context.xml is specific to each context in Tomcat, taken from Tomcat's documentation it explains
this well:
The Context element represents a web application, which is run within a particular
virtual host. Each web application is based on a Web Application Archive (WAR) file, or
a corresponding directory containing the corresponding unpacked contents, as
described in the Servlet Specification (version 2.2 or later). For more information about
web application archives, you can download the Servlet Specification, and review the
Tomcat Application Developer's Guide.
Essentially, it's application-specific configuration.
In order to operate correctly, we'll need to set up a Resource in server.xml and a reference to that
resource inside of context.xml.