Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:03:25+00:00 2026-06-03T06:03:25+00:00

I am using a C3P0 Connection Pool with Hibernate to execute some JDBC operations.

  • 0

I am using a C3P0 Connection Pool with Hibernate to execute some JDBC operations. However, I am getting a “Closed Connection” (SQL Error: 17008, SQLState: null) error after some time of usage.

I am using the org.hibernate.jdbc.Work interface to perform my operations:

public class ClassThatDoesWork implements Work {

    @Override
    public void execute(final Connection connection)
            throws SQLException {

        doSomeWork();
        //should connection be closed here?
    }
}

My question is: should the connection object passed as an argument to the execute() method be closed at the end of that method or Hibernate takes care for that automatically?

EDIT
These are the Hibernate and c3p0 parameters used:

hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
hibernate.connection.pool_size=10
hibernate.dialect=org.hibernate.dialect.Oracle9iDialect
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.show_sql=false
acquireIncrement=3
acquireRetryDelay=500
acquireRetryAttempts=5
breakAfterAcquireFailure=false
checkoutTimeout=0
connectionTesterClassName=com.mchange.v2.impl.DefaultConnectionTester
debugUnreturnedConnectionStackTraces=false
dataSourceName=irrelevantDB
identityToken=irrelevantDB
idleConnectionTestPeriod=0
initialPoolSize=3
maxConnectionAge=0
maxIdleTime=7200
maxIdleTimeExcessConnections=0
maxPoolSize=20
maxStatements=50
maxStatementsPerConnection=0
minPoolSize=5
numHelperThreads=3
propertyCycle=0
testConnectionOnCheckin=false
testConnectionOnCheckout=true
unreturnedConnectionTimeout=0
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=10
hibernate.c3p0.max_statements=50
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:03:27+00:00Added an answer on June 3, 2026 at 6:03 am

    The database connection is passed in as a method argument by Hibernate, and thus should not be tampered with (e.g. closed) inside the method — this is Hibernate’s responsibility.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am unable to get a connection pool using c3p0 with Hibernate and Oracle.
I'm running a Spring/Hibernate connecting to MySQL setup using c3p0 as my connection pool.
I have some c3p0 pool encapsulated in a class that I use to execute
I build j2ee application using spring, hibernage-JPA and c3p0 for connection pool. I have
I'm developping app using java, c3p0 for connection pooling and SQL Server 2005 for
I am using the JPA(hibernate) for the ORM and c3po for connection pooling. While
I'm using hibernate 3 with c3p0 for a program which constantly extracts data from
I'm using Spring 3.0.2, Hibernate 3.5.0 and c3p0 0.9.1.2 and I'm having a ton
<property name=connection.provider_class>org.hibernate.connection.C3P0ConnectionProvider</property> <property name=c3p0.max_size>100</property> <property name=c3p0.idleConnectionTestPeriod>300</property> <property name=c3p0.acquire_increment>1</property> <property name=c3p0.idle_test_period>100</property> <!-- seconds --> <property
I am using JTDS to connect to MS-SQL 2005. I am using c3p0 as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.