Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Notice that, when doing the DataSource lookup, you must prefix the name of the resource with java:comp/env/

Sample Project

Here's a sample web application project that shows where all the files go. This one shows how to access a DataSource from a JSP page: attachment:datasourcedemo.war

Please Note

This technique is Tomcat-specific. If you deploy your web application to another application server (or even an older version of Tomcat), you will need to configure a DataSource according to your application server's documentation, and reference it in your application's web.xml.