I've been tasked with the maintenance of a client's legacy Tomcat 8.0 application servers. The person who initially configured Tomcat on them is no longer with the company, and I've basically been thrown into the deep end with no prior Tomcat or Java knowledge. Their Java developers are also unfamiliar with the Tomcat setup. I've been reading through a bunch of documentation to try to make sense of it all, so excuse my extreme newbieness.
The servers are running a single Java application under Tomcat that connects to a MySQL server. The data sources are configured in the META-INF/context.xml file of the Java application. It contains a bunch of Resource elements with the javax.sql.DataSource type. We're in the process of adopting ProxySQL in front of MySQL, to act as the connection pooler and for separating read and write traffic to different database instances. After this, we have no need for DBCP or any other Java-level pooling – in fact, having two levels of connection pooling would probably be detrimental to performance, and certainly to our ability to diagnose issues. Trouble is, based on my reading of the JNDI Resources HOW-TO, the Java EE specs require that the data source implementation features connection pooling, and Tomcat follows this. Accordingly, the Resource element features a bunch of pooling-related DBCP attributes. I haven't been able to figure out how to entirely disable DBCP so that ProxySQL could handle the pooling entirely. I can leave out the pooling-related Resource attributes, but that probably just causes a bunch of defaults to be used. I could maybe configure a "pool" of one connection on the Java side, but my intuition says that's a bad idea, and I'm not sure how to do it anyway. What seems the most realistic option is configuring the MySQL connection in some other, non-pooled fashion outside Tomcat, but I don't know how. With the last option, it would have to be something that requires minimal code changes in the Java application. Any guidance would be appreciated. - JK