I am using Spring configuration file to configure C3P0. For monitoring the DataSource, I am configured net.bull.javamelody.SpringDataSourceFactoryBean
as indicated in the javamelody user guide. But my report shows 0 active jdbc connections, where since my minPoolSize is 10. What I missed.
In web.xml
addedmonitoring-spring.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:net/bull/javamelody/monitoring-spring.xml,
</param-value>
</context-param>
In Spring jdbc configuration file
<bean id="sql2oDatasource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="#{dbProps['ops.jdbc.driverClassName']}"/>
<property name="jdbcUrl" value="#{dbProps['ops.jdbc.url']}"/>
<property name="user" value="#{dbProps['ops.jdbc.username']}"/>
<property name="password" value="#{dbProps['ops.jdbc.password']}"/>
<property name="maxPoolSize" value="#{dbProps['ops.c3p0.max_size']}" />
<property name="minPoolSize" value="#{dbProps['ops.c3p0.min_size']}" />
<property name="maxStatements" value="#{dbProps['ops.c3p0.max_statements']}" />
<property name="checkoutTimeout" value="#{dbProps['ops.c3p0.timeout']}" />
<property name="preferredTestQuery" value="SELECT 1"/>
</bean>
<bean id="sql2oSession" class="org.sql2o.Sql2o">
<constructor-arg ref="wrappedDBDataSource" />
<constructor-arg value="PostgreSQL" type="org.sql2o.QuirksMode" />
</bean>
<bean id="wrappedDBDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean" primary="true">
<property name="targetName" value="sql2oDatasource" />
</bean>
I tried to convey DriverClass
both net.bull.javamelody.JdbcDriver
in the data source and driver
how
<property name="properties">
<props>
<prop key="driver">org.postgresql.Driver</prop>
</props>
</property>
But the driver is postgresql
not registered this way.
source
share