How does connection pooling work?
If Dedicated Servers are private chauffeurs and Shared Servers are public buses, then Connection Pooling is like a high-end Car-Sharing Service (like Zipcar or Uber).
In a modern web environment, thousands of users might visit your site every minute. If the database had to create a brand-new connection for every single person who clicked a link, the server would crumble under the weight of the "handshake" overhead.
Connection pooling solves this by keeping a cache of "ready-to-use" connections alive.
Connecting to an Oracle database is an expensive operation in terms of time and CPU.
Authenticate the user (check password/permissions).
Allocate memory (PGA) on the server.
Spawn a new process or thread.
Establish the network handshake.
This can take hundreds of milliseconds. If your web page needs to load in under 2 seconds, you can't afford to waste 20% of that time just saying "hello" to the database.
A Connection Pool sits between the Application Server (like Java, Python, or .NET) and the Database.
Startup: When the app server starts, it creates a "pool" of, say, 20 open connections to Oracle.
Request: A user visits the site. The app borrows an existing, authenticated connection from the pool.
Execution: The app runs the SQL and gets the results.
Release: Instead of "closing" the connection, the app returns it to the pool.
Not all pools live in the same place. There are two main ways to implement this:
Frameworks like HikariCP (Java), SQLAlchemy (Python), or ODP.NET manage the pool within the application's memory.
Pro: Lightning fast; the application doesn't even have to talk to the network to "get" a connection.
Con: If you have 10 separate app servers each holding 50 connections, you have 500 open sessions on your database, even if no one is using the site.
This is an Oracle-specific feature (introduced in 11g) where the pool lives on the database server itself.
Pro: It allows thousands of different application processes to share a small, manageable pool of server-side "connection brokers."
Best For: Languages like PHP or Python that traditionally struggle with persistent connections.
People often confuse these two, but they happen at different layers:
| Feature | Connection Pooling | Shared Server (MTS) |
| Location | Application Side / Driver. | Database Side / Instance. |
| Main Goal | Avoid the cost of re-connecting. | Reduce the number of OS processes. |
| Connectivity | Connections are held open. | Sessions are "multiplexed" over workers. |
To avoid database "hangs," keep these settings in mind:
Min Pool Size: How many connections stay open during quiet hours (e.g., 5).
Max Pool Size: The absolute limit. If your app hits this, users will wait in a queue. Never set this higher than your database's SESSIONS parameter can handle.
Max Idle Time: How long a connection can sit unused before the pool kills it to save memory.
Peer Tip: The most common cause of "Database Hanging" in web apps isn't the database—it's a Connection Leak. This happens when a developer "borrows" a connection from the pool but forgets to "return" it in their code. Eventually, the pool empties, and the app stops working.