JNDI Datasource configuration is covered extensively in the JNDI-Resources-HOWTO. However, feedback from tomcat-user has shown that specifics for individual configurations can be rather tricky.
Here then are some example configurations that have been posted to tomcat-user for popular databases and some general tips for db usage.
You should be aware that since these notes are derived from configuration and/or feedback posted to tomcat-user YMMV :-). Please let us know if you have any other tested configurations that you feel may be of use to the wider audience, or if you feel we can improve this section in anyway.
Please note that JNDI resource configuration changed somewhat between Tomcat 5.0.x and Tomcat 5.5.x. You will most likely need to modify older JNDI resource configurations to match the syntax in the example below in order to make them work in Tomcat 8.
Also, please note that JNDI DataSource configuration in general, and this tutorial in particular, assumes that you have read and understood the Context and Host configuration references, including the section about Automatic Application Deployment in the latter reference.