Creating a JNDI DBCP Connection Pool

Create a new folder called META-INF (in capitals) in your application, at the same level as WEB-INF.

Copy the source code below into a file called context.xml

Your application directory structure will look something like this:

Note: you will need to customise this file with your own database name, username and password.

Source Code (Copy and Paste):

<?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="jdbc/mydatabase" auth="Container" type="javax.sql.DataSource" username="YOUR_USERNAME" password="YOUR_PASSWORD" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://mysql.metawerx.net:3306/YOUR_DATABASE_NAME?autoReconnect=true" maxActive="10" maxIdle="4"/> </Context>