I am using a JNDI context to create a data source for JDBC drivers in a Tomcat context.xml file like this,
<Resource name="db/test"
type="javax.sql.DataSource"
driverClassName="com.test.jdbc.Driver"
url="jdbc:fastdb://localhost:3306/session_db?autoReconnect=true&connectTimeout=5000&socketTimeout=5000"
zeroDateTimeBehavior="convertToNull"
username="dbuser"
password="password"
maxActive="100"
maxWait="2"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true" />
By default, Tomcat will use the DBCP factory data source and will create the data source pools. The specific database and driver that we use already support lower-level consolidation, and the additional pool is actually detrimental to performance. Do I need to create a basic data source (without combining) using the JNDI resource so that I can switch between different databases with minimal configuration changes?
I know that I can write my own factory data source or use those from other drivers to achieve this, but I'm looking for an easier solution.