Reputation: 5259
I'm confused on when to use a standalone C3P0 specific config file such as c3p0-config.xml
vs simply adding configuration information to the standard Context.xml file. For example:
<Resource auth="Container"
description="DB Connection"
driverClass="com.mysql.jdbc.Driver"
maxPoolSize="1000"
minPoolSize="30"
acquireIncrement="1"
name="jdbc/myDB"
user="myUserName"
password="myPassword"
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
jdbcUrl="jdbc:mysql://localhost:3306/MyDB?autoReconnect=false"
preferredTestQuery = "SELECT 1"
idleConnectionTestPeriod = "1800"
/>
I currently use the context.xml approach but I see documentation for a completely separate config file. Is there a correct way or a trade off for choosing either?
Upvotes: 0
Views: 393
Reputation: 14073
c3p0 is not, in general, used just with Tomcat. but within Tomcat, the approach that you are taking should work fine. there are some library-wide (rather than DataSource-specific) properties that can only be set in a c3p0.properties or typesafe/HOCON config file, but those are rarely used. as long as all you need to configure are DataSource-specific properties, you can keep doing what you are doing.
Upvotes: 2