I figured out the problem. The previously mentioned configuration did not configure c3p0 at all.
Earlier my datasource bean looked like:
<bean id="datasource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver">
        </property>
        <property name="url">jdbc:mysql://localhost:3306/ProductSchema</property>
        <property name="username">userName</property>
        <property name="password">pass</property>
    </bean>

I changed it to:
    <bean id="dataSource"
        class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="com.mysql.jdbc.Driver">
        </property>
        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/ProductSchema">
        </property>
        <property name="user" value="userName"></property>
        <property name="password" value="pass"></property>
        <property name="acquireIncrement" value="1"></property>
        <property name="initialPoolSize" value="10"/>
        <property name="maxPoolSize" value="100"/>
        <property name="minPoolSize" value="10"/>
        <property name="preferredTestQuery" value="SELECT 1"/>
        <property name="testConnectionOnCheckin" value="true"/>
        <property name="idleConnectionTestPeriod" value="100"/>
        <property name="maxIdleTime" value="3600"/>
    </bean>

Removed the c3p0 properties from the sessionFactory bean.
I can view the pooled connections in mysql administrator.

Cheers,
Samarth


On Wed, Oct 20, 2010 at 2:34 PM, samarth s <samarth.s.seksaria@gmail.com> wrote:
Hi,

I have configured my log4j.xml as

   <logger name="com.mchange.v2.c3p0">
      <priority value="DEBUG"/>
   </logger>
   <logger name="com.mchange.v2.log">
      <priority value="DEBUG"/>
   </logger>
   <logger name="com.mchange">
      <priority value="DEBUG"/>
   </logger>
   <logger name="com.mchange.v2.c3p0.impl">
      <priority value="DEBUG"/>
   </logger>

I am using hibernate on spring. I have set c3p0 properties in the sessionFactory bean as follows:
<bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLInnoDBDialect
                </prop>
               
                <prop key="hibernate.connection.release_mode">after_statement</prop>
                <prop key="hibernate.c3p0.initial_pool_size">30</prop>
                <prop key="hibernate.c3p0.min_size">30</prop>
                <prop key="hibernate.c3p0.max_size">100</prop>
                <prop key="hibernate.c3p0.timeout">25200</prop>
                <prop key="hibernate.c3p0.max_statements">0</prop>
                <prop key="hibernate.c3p0.idle_test_period">100</prop>
                <prop key="hibernate.c3p0.test_connection_on_checkout">true</prop>
                <prop key="hibernate.c3p0.test_connection_on_checkin">true</prop>
                <prop key="hibernate.c3p0.preferredTestQuery">SELECT 1</prop>

            </props>
        </property>

Is this sufficient to activate c3p0 logging?
I am not even sure if c3p0 is being used at all. I have read about com.mchange.v2.c3p0.DEBUG set to false at the jar's compile time, but how do i know its value in my jar?

Thanks for any directions,
Samarth