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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:31:49+00:00 2026-05-24T22:31:49+00:00

I work on a project where the design is to have a database per

  • 0

I work on a project where the design is to have a database per customer. I have managed to read in Tomcat documentation and establish a connection pool. Since the databases are created automatically by the application when a customer registers, I needed a way to make a dynamic pool. the following post on stack overflow gave the hint of what is required:

Using dynamic Datasource with Tomcat

and I found on the web a page showing how to do this:

Writing and using a Tomcat ObjectFactory

I still have few questions:

1- who takes care of managing the connections in the pool ?
in the datasource declaration in context.xml, we define some parameters that control various aspects like max idle time and max number of connections, etc. does tomcat handle this or do I have to take care of it in the implementation that i make when coding a class that implements the ObjectFactory interface ?

2- As I understand, when connections are closed, they return to the pool. suppose that I make a dynamic pool that has maximum 20 connections. and then 30 customers log in. so the pool returns 20 connections for the first 20 customers. when those connections are closed, they return to the pool and the next 10 customers will ask for connections to different databases than the ones already found in the pool. and the question is: will the pool automatically drop 10 connections and add new ones with the correct databases ? in if this is the case, does this really have an advantage over opening a connection upon request without a pool ? (asked with the thought of a site that will be heavily loaded. the amount of connection drop if i guessed correctly might be very high that it wouldn’t justify what the pool is there to do: minimize creating connections from scratch)

3- I also wanted to ask if it is ok to implement it myself (considering I am new to this) or if i should find a library that does this (in case its not a task for the beginner in this area).

4- are there any alternatives for connection pools for managing connections to multiple databases that are added dynamically in an efficient way? (in case datasource will not help) what are the approaches used in similar situations?

Thank you in advance for your effort.

  • 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-05-24T22:31:50+00:00Added an answer on May 24, 2026 at 10:31 pm

    In declaring a datasource you can specify a datsource class, such as the Oracle datasource. It uses the parameters specified to manage the datasource for you. It is best to let the datasource manage itself. I have tried to write one and it is not simple.

    I think the datasource will not be adequate for you, I could be wrong. A datasource requires a database url, username and password that will be fixed for the lifetime of the datasource.

    Having different databases for different users will break this.

    Look at the reference you gave above, the answer mentions using a resource which is different from a datasource.

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

Sidebar

Related Questions

I have a design idea for a large project at work and I think
I need some help with a work project I have been assigned. At the
Simply put: I have a database design in my head and I now want
I have a complex, 3NF database being provided to me for a particular project.
I have a project here that connects to an in-production database and grabs tables
I've been trying to design a database schema for a side project but I
I have a potentially stupid question about a potentially stupid database design. Say I
I have to work on a project for my under graduate final year. I
In the current project we work on, we have a main window with several
I have recently started work on a project that has already been running for

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.