Translate

Показ дописів із міткою JNDI. Показати всі дописи
Показ дописів із міткою JNDI. Показати всі дописи

четвер, 16 січня 2014 р.

Configuring JNDI DataSource for Database Connection Pooling in Tomcat


This tutorial shows you how to create a JNDI resource that represents a JDBC DataSource in Tomcat, and then how to configure a Java web application in order to access the JNDI DataSource. The benefits of using a JNDI DataSource are:
  • Utilizing database connection pooling services provided by the container, i.e. Tomcat uses Commons DBCP and Commons Pool as the implementation (tomcat-dbcp.jar).
  • Externalizing database connection and make it independent from the web application itself.
  • Sharing database connections across applications deployed in the container.
The following examples are tested in Tomcat 7 and MySQL Database 5.5.