Multiple choice technology programming languages

You are creating a web application for an online product ordering system. You will be using data from several different databases and to reduce the load on the databases you have decided to use connection pooling. You have a ConnectionPool class and you want one pool for each database however you will have to connect to a variable number of databases. What pattern should you use?

  1. Abstract factory

  2. Factory Method

  3. Prototype

  4. Singleton

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Singleton ensures exactly one instance exists per database, with global access. For connection pools, you want one pool object managing connections for each database. Factory patterns create new instances, and Prototype copies existing ones - neither controls instance count like Singleton does.