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 9253453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:13:21+00:00 2026-06-18T11:13:21+00:00

We have a web application that uses C3P0 to pool our connections. We inject

  • 0

We have a web application that uses C3P0 to pool our connections. We inject C3P0 as a data source into JdbcTemplate. You can see how we do this here:

<bean id="dataSourceDev" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="${databasedev.driver}" />
    <property name="jdbcUrl" value="${databasedev.url}"/>
    <property name="user" value="${databasedev.username}"/>
    <property name="password" value="${databasedev.password}"/>

    <property name="initialPoolSize" value="5" />
    <property name="minPoolSize" value="5" />
    <property name="maxPoolSize" value="1000" />
    <property name="acquireIncrement" value="5" />
    <property name="maxStatements" value="1000" />
    <property name="maxStatementsPerConnection" value="1000"/>
    <property name="maxIdleTime" value="10800"/> <!-- 3 hours -->
</bean>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <constructor-arg>
         <ref bean="dataSourceDev" />
    </constructor-arg>
</bean>

<bean id="someDaoBean" class="com.gedi.platform.dao.SomeDaoClass">
    <property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>

<bean id="someResourceClass" class="com.gedi.platform.SomeResourceClass">
    <property name="someDao" ref="someDaoBean" />
</bean>

You can see that it’s a Java EE web application – it uses Jetty as its application server. My question is, how does Jetty instantiate our beans, and how will that affect connection pooling? If we have dozens of users using the web site at different times, will all of these users be placed in the same connection pool? Or is there only one connection pool per client, in which every HTTP client creates new instances of Resource, DAO, JdbcTemplate and C3P0?

Am I being clear? What I want to have is one connection pool for all HTTP requests, regardless of whether they come from web browsers originating in Boston or New Zealand. That way, the connection pool is exerting its maximum effects. However, if a new connection pool is instantiated for every HTTP client, then the pooling doesn’t end up being much of an improvement.

Edit

An important tidbit – We use the Jersey reference implementation of JAX-RS to produce a RESTful interface. So our servlet dispatches requests through Jersey which finds a suitable Resource class/method to handle them. I wonder whether Jersey re-instantiates these classes on every request, or keeps one instance of them at all times.

  • 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-18T11:13:22+00:00Added an answer on June 18, 2026 at 11:13 am

    Neither Jersey nor Jetty are relevant here. Spring is important here. And in Spring every bean (like your dataSourceDev, jdbcTemplate and someDaoBean) are singletons. That means when Spring application context starts, it will creatly exactly one instance of each of them.

    That means no matter what uses your DataSource (web request, background job, etc.), the same instance (thus the same connection pool) is used. You are right that if connection pool was created per each request, it would not have been much of an improvement. Actually it would be much, much slower.

    But in your case (and this is how 99% of web applications work) all code requiring database access will compete and reuse the same connections (or wait if none available). BTW make sure your database can actually handle 1000 concurrent connections.

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

Sidebar

Related Questions

We have a web application that uses SQL Server 2008 as the database. Our
I have a web application that uses AJAX to grab JSON data from the
I have a Dynamic Data Entities Web Application that uses a database with GUIDs
We have a web-application that uses T4 templates to render pages. Pages can contain
I have a web application that uses fixed css width. (1280px). With jquery, I
I have a web application that uses TONS of javascript, and as usual, there
I have a web application that uses AzMan authorization to grant different functionality to
I have a web application that uses two databases. DB1 Users perform their CRUD
I have a web application that uses the CDO Message object to email reports.
I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This

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.