Reputation: 375
Folks, I am a java newbie. I am trying to debug an application written by some one else. I see following statements when ever the application hits the database.
DEBUG [TP-Processor9] - ooo Using Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@f266c22]
Using Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1f792416]
please note the ID after @ symbol
I want to understand if the code is creating new connection to the DB for each query??
here is my bean configuration :
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close"
p:driverClass="com.mysql.jdbc.Driver"
p:jdbcUrl="${db.url}"
p:user=""
p:password=""
p:idleConnectionTestPeriod="25200"/>
Upvotes: 0
Views: 762
Reputation: 3031
Don't worry it doesn't create a new connection for each query. It only creates a new proxy for the JDBC connection. So although the proxy object (instance of NewProxyConnection) is different the connection to DB is reused from the pool.
Upvotes: 1