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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:49:26+00:00 2026-06-18T15:49:26+00:00

I m performing a connection pooling operation in jsp. I created a static function

  • 0

I m performing a connection pooling operation in jsp.
I created a static function in a particular class called MCE_Server.java and included the following

 public static void makeConnectionPool()
 {
    try
    {
        cpds = new ComboPooledDataSource();
        cpds.setDriverClass("com.mysql.jdbc.Driver");
        cpds.setJdbcUrl("jdbc:mysql://localhost:3306/mce_db");
        cpds.setUser("root");
        cpds.setPassword("xxxxxx");
        cpds.setMaxPoolSize(100);
        cpds.setMinPoolSize(10);
        cpds.setAcquireIncrement(20);
    } 
    catch (PropertyVetoException ex) 
    {

        Logger.getLogger(MCE_Server.class.getName()).log(Level.SEVERE, null, ex);
    }

 }

Following static function is called from a jsp page

http://................/dbActivatePage.jsp

where i have included the function

      <%@page import="xxxxx.MCE_Server"%>
      <html>
      .
      .
      .
      <body>
      <%
              MCE_Server.makeConnectionPool();
      %>
      .
      .
      .
      </body>
      </html>

I m planning to get the required Connection as per the static function included in MCE_Server.java as follows:

       public static Connection getConnectionfromPool() throws SQLException
       {
             return cpds.getConnection();
       }

i.e whenever i need to get a connection. I’ll include MCE_Server.getConnectionfromPool().

Now the Problem i m having is i m receiving an error

java.sql.SQLException: Connections could not be acquired from the underlying database!

Why I m getting this……??

On Further trial and error method…. i found out that the statements below the code
cpds = new ComboPooledDataSource(); is getting executed.

So, what might be the problem here. Is my approach correct ?

  • 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-18T15:49:27+00:00Added an answer on June 18, 2026 at 3:49 pm

    Well looking at the error u r showing.

    java.sql.SQLException: Connections could not be acquired from the underlying database!.

    It seems like your c3p0 configuration is right although i agree with Waldman’s idea of using ServletContextListener. In your case, I strongly believe that the problem has to do something with mysql class path. Please Check whether u have properly included the mysql connector.

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

Sidebar

Related Questions

I have created the following function for checking the connection status: private void checkConnectionStatus()
I am performing a create operation on an entity. The entity is a Function
While performing a conditional DELETE operation in one of my InnoDB tables, which apparently
As per my understanding, JDBC Connection Pooling (at a basic level) works this way:
Preamble: All data connection strings, connections, etc are created using DbProviderFactories. Code is mixed
I am performing a Maven build on my client's Java codebase, and one of
Performing a query comparing phrases is a pain in the ass. Look the following
I am seeing mysql insert times performing orders of magnitude slower when called over
Creating a class which holds some threads, performing tasks and finally calling a callback-method
I am performing a simple exercise of opening an SQL Server database connection, pulling

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.