- The “Login Pool Is Empty” error usually arises when applications can’t establish database connections, often due to issues like incorrect credentials, network blocks, or exhausted connections rather than just an empty connection pool.
- To fix this, first check logs for deeper error details such as authentication failures or network issues, and verify database connectivity directly from the app server.
- After connectivity is ensured, review database URLs, credentials, firewall rules, and tune connection pool settings if necessary, but only after confirming core connection issues are resolved for optimal application function.
If your application logs show an error like “Pool is empty, failed to create/setup connection”, “Login pool is empty”, or “Connection creation failed”, your app is unable to create a usable database connection when it needs one.
This issue is commonly seen in Java applications using HikariCP, Spring Boot, JDBC, Hibernate, PostgreSQL, MySQL, Oracle Database, SQL Server, cloud databases, Docker containers, and Kubernetes deployments. The message may look like a connection pool issue, but the actual cause is usually deeper: incorrect database credentials, network restrictions, exhausted database connections, an unavailable database server, SSL problems, or a bad connection string.
A connection pool keeps a limited number of reusable database connections ready for your application. When all existing connections become unavailable and the pool cannot open a replacement connection, the pool becomes empty. Your app then starts failing requests because it has no available path to the database.
What Does “Login Pool Is Empty and Connection Creation Failed” Mean?
A database connection pool is a group of open database connections that your application reuses instead of creating a new connection for every request. Reusing connections improves speed and prevents your database from being overloaded by frequent login and logout operations.
When your application needs database access, it borrows one connection from the pool. After completing the query, it returns that connection to the pool so another request can use it.
The problem starts when the pool has no healthy connections left. This can happen when connections are closed, invalid, timed out, leaked, rejected by the database, or blocked by the network. The connection pool then attempts to create a new connection, but that attempt also fails.
You may see log entries similar to these:
- HikariPool-1 – Pool is empty, failed to create/setup connection
- Connection is not available, request timed out after 30000ms
- java.sql.SQLTransientConnectionException
- org.postgresql.util.PSQLException: The connection attempt failed
- Communications link failure
- ORA-12541: TNS: no listener
- Access denied for user
- Connection refused
The important thing to understand is that the pool warning is usually not the root cause. The root cause is normally written a few lines below the pool error in your application logs.
Common Causes of Login Pool Is Empty and Connection Creation Failed
Before changing your connection pool settings, identify why the application cannot establish a database connection. Increasing pool size without finding the real issue can make the problem worse, especially on smaller database servers.
1. Wrong Database URL, Host, Port, or Database Name
Your application may be trying to connect to the wrong database server, an old IP address, an incorrect port, or a database name that no longer exists. This often happens after moving from local development to production, changing cloud providers, restoring a database backup, or updating environment variables.
For example, PostgreSQL usually uses port 5432, MySQL and MariaDB commonly use 3306, Microsoft SQL Server often uses 1433, and Oracle installations may use ports such as 1521. However, your server may use a custom port, so do not assume the default is always correct.
2. Database Server Is Offline or Not Listening
Your database service may have stopped, crashed, restarted, run out of memory, reached its connection limit, or failed after a server update. In Oracle environments, a listener problem can prevent new client connections even when the database itself is running.
If the database server is not accepting connections, your pool cannot create replacement connections. Existing requests may work briefly if old pooled connections are still alive, but the application will eventually fail once those connections are closed or invalidated.
3. Firewall, Cloud Security Group, or Network Issue
A firewall may block the application server from reaching the database server. This is especially common when your database is hosted on AWS RDS, Google Cloud SQL, Azure Database, DigitalOcean, Vultr, Railway, Render, Supabase, Neon, or another managed platform.
A database may also allow connections only from approved IP addresses. If your application server IP changed, a cloud firewall rule was removed, or a Docker/Kubernetes network configuration changed, the connection pool can suddenly become empty.
4. Invalid Username, Password, SSL, or Authentication Settings
Incorrect credentials are one of the simplest causes of this error. Database passwords may be changed manually, rotated through a secret manager, updated in the control panel, or overridden by an old environment variable.
SSL settings can also cause connection creation failures. Some managed databases require SSL connections, while others may reject an SSL configuration that does not match the server certificate or connection mode.
5. Connection Pool Exhaustion or Connection Leaks
A pool can become empty when every connection is busy for too long. This commonly happens when queries are slow, transactions are left open, background jobs run too many database tasks at once, or application code fails to close connections properly.
Connection leaks are particularly dangerous because the app may appear healthy at first. Over time, each leaked connection remains checked out, leaving fewer available connections until the pool is completely drained.
How to Fix Login Pool Is Empty and Connection Creation Failed
Step 1: Find the Real Error Below the Connection Pool Message
The connection pool error is often only a warning. The actual reason is usually printed immediately after it in the logs. Look for the first error beginning with terms such as Caused by, SQLException, PSQLException, CommunicationsException, UnknownHostException, or SocketTimeoutException.
For example, these messages point to different fixes:
- Connection refused: The database server is offline, the host is wrong, the port is wrong, or a firewall is blocking access.
- Password authentication failed: Your database username or password is incorrect.
- Unknown host: The database hostname cannot be resolved through DNS.
- Timeout: The app cannot reach the database in time, usually because of a firewall, network issue, overloaded server, or incorrect endpoint.
- Too many connections: The database has reached its allowed connection limit.
- No pg_hba.conf entry: PostgreSQL is rejecting the app server IP address or authentication method.
- ORA-12541: Oracle listener is unavailable, the host is incorrect, or the port is wrong.
- SSL handshake failed: The SSL mode, certificate, or JDBC connection properties need correction.
Do not tune HikariCP first if the logs clearly show an authentication error or connection refusal. Pool configuration cannot solve a bad password or a blocked network path.
For Spring Boot applications, check logs from the time the app starts. You may see the database failure before the HikariCP warning appears. HikariCP is Spring Boot’s default pool in common JDBC and JPA setups, so the pool message often appears after the original driver error. :contentReference[oaicite:0]{index=0}
Step 2: Test Database Connectivity Outside Your Application
Next, test whether the application server can connect to the database directly. This separates an application configuration issue from a database or network issue.
Run the test from the same machine, container, virtual machine, or Kubernetes pod where your application runs. Testing from your own laptop is not enough because your laptop may have access that the production server does not.
For MySQL or MariaDB
mysql -h YOUR_DB_HOST -P 3306 -u YOUR_DB_USER -p
If the login fails, the problem is outside your app. Check the host, port, username, password, database permissions, firewall rules, and MySQL service status.
For PostgreSQL
psql “host=YOUR_DB_HOST port=5432 dbname=YOUR_DB_NAME user=YOUR_DB_USER sslmode=require”
If PostgreSQL says password authentication failed, the server is reachable but the login details are incorrect. If it says no pg_hba.conf entry exists, the server is reachable but configured to reject your app server. PostgreSQL documentation confirms that this error means the database received the request but did not find an allowed matching access rule. :contentReference[oaicite:1]{index=1}
For Microsoft SQL Server
sqlcmd -S YOUR_DB_HOST,1433 -U YOUR_DB_USER -P YOUR_PASSWORD
If SQL Server is hosted remotely, confirm that TCP/IP is enabled and that remote connections are allowed.
For Oracle Database
lsnrctl status
If you receive ORA-12541, Oracle recommends checking whether the listener is running and verifying that the connection string uses the correct host and port. :contentReference[oaicite:2]{index=2}
Once the direct command works from the app server, copy the same verified host, port, database name, username, and SSL requirements into your application configuration.
Step 3: Check Your Database URL and Environment Variables
Incorrect environment variables are a major cause of the Login Pool Is Empty and Connection Creation Failed issue. A deployment may appear correct in your repository, but the active production environment may still be using old variables.
Review your application configuration carefully. Check application.properties, application.yml, Docker Compose files, Kubernetes secrets, cloud environment settings, CI/CD variables, and server-level environment files.
Spring Boot PostgreSQL Example
spring.datasource.url=jdbc:postgresql://db.example.com:5432/mydatabase?sslmode=require
spring.datasource.username=mydbuser
spring.datasource.password=your-secure-password
spring.datasource.driver-class-name=org.postgresql.Driver
Spring Boot MySQL Example
spring.datasource.url=jdbc:mysql://db.example.com:3306/mydatabase?useSSL=true&serverTimezone=UTC
spring.datasource.username=mydbuser
spring.datasource.password=your-secure-password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
Spring Boot Oracle Example
spring.datasource.url=jdbc:oracle:thin:@//db.example.com:1521/yourservice
spring.datasource.username=mydbuser
spring.datasource.password=your-secure-password
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
Do not leave spaces before or after credentials in environment variables. Also check whether your password contains special characters such as @, :, /, &, or #. These characters can break URLs when credentials are embedded directly inside a connection string.
For production apps, keep credentials outside your source code. Use protected environment variables, encrypted secrets, or your cloud provider’s secret manager. This reduces the risk of password exposure and makes credential rotation easier.
Step 4: Fix Network, Firewall, and Database Access Rules
If your username and password are correct but the application cannot reach the database, check the network path between your app and database.
Start by confirming that the app server can reach the database port. On Linux, you can use a command such as:
nc -vz YOUR_DB_HOST 5432
Replace 5432 with your actual database port. A successful response means the network path is open. A timeout or refusal means the database host, firewall, service, or port needs attention.
Check Cloud Firewall and Security Rules
For cloud databases, confirm that the database allows inbound access from the application server. Add the application server’s private IP, public IP, VPC range, security group, or internal network rule as required by your provider.
Do not open your database to every IP address unless you are testing briefly in a controlled environment. Public database access can expose your server to brute-force attempts, unauthorized scanning, and data theft risks.
Check PostgreSQL Access Rules
For self-hosted PostgreSQL, review the pg_hba.conf file. This file controls which hosts, users, databases, and authentication methods are allowed to connect.
A typical secure entry may allow only your application server IP range:
host mydatabase myappuser 10.0.0.0/24 scram-sha-256
After editing PostgreSQL access rules, reload or restart PostgreSQL as required by your operating system and deployment setup.
Check Docker and Kubernetes Networking
In Docker, do not use localhost to reach a database running in another container. Inside a container, localhost refers to that same container. Use the Docker Compose service name, internal hostname, or configured network alias instead.
In Kubernetes, check the service name, namespace, endpoint availability, network policy, secret values, and pod-to-pod connectivity. A database connection may fail when the service name changes or a network policy blocks traffic between namespaces.
Step 5: Tune the Connection Pool and Fix Connection Leaks
Once database connectivity is working, review your connection pool configuration. This is important when the database is reachable but your app still runs out of connections during traffic spikes or long-running requests.
Do not set an extremely large pool size just because requests are timing out. A larger pool can create more database sessions, more CPU contention, more memory use, and slower performance. Database performance can actually get worse when too many application connections are created at once. Oracle’s database guidance specifically warns that uncontrolled dynamic connection growth can create connection storms and recommends carefully sized, more stable pools. :contentReference[oaicite:3]{index=3}
Recommended HikariCP Starting Configuration
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.minimum-idle=2
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.validation-timeout=5000
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.leak-detection-threshold=60000
These values are reasonable starting points for a small or medium application, but they are not universal. Your final settings should depend on database capacity, query duration, user traffic, background jobs, server CPU, memory, and how many app instances connect to the same database.
Why These HikariCP Settings Help
- maximum-pool-size: Limits how many database connections this app instance can open.
- minimum-idle: Keeps a small number of ready-to-use connections available.
- connection-timeout: Controls how long the app waits for a pooled connection.
- validation-timeout: Limits how long connection validation can take.
- idle-timeout: Removes unused connections after they remain idle for a set time.
- max-lifetime: Recycles older connections before infrastructure or database services close them unexpectedly.
- leak-detection-threshold: Logs a warning when code holds a connection too long.
For Oracle and Spring Boot setups, HikariCP properties can be configured using the spring.datasource.hikari namespace, including settings such as maximum pool size and minimum idle connections. :contentReference[oaicite:4]{index=4}
How to Find and Fix Database Connection Leaks
A connection leak occurs when application code borrows a database connection but does not return it. This often happens when exceptions occur before cleanup code runs.
In plain JDBC code, always use try-with-resources. It automatically closes the connection, statement, and result set even when an error occurs.
try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql); ResultSet resultSet = statement.executeQuery()) { }
Do not manually open a connection and assume it will be closed later. In a busy application, even a small leak can drain the connection pool after enough requests.
Also inspect long-running transactions. A transaction that remains open while your application waits for an external API, sends emails, processes files, or performs slow background work can hold a database connection much longer than necessary.
Additional Fixes to Try
Restart the Database and Application Carefully
If the issue started after a deployment, database restart, server update, certificate rotation, or network outage, restart the application after confirming the database is healthy. This allows the pool to discard stale connections and create fresh ones.
Restarting should not be your permanent fix. If the error returns regularly, inspect logs, connection count, query performance, network stability, and leak warnings.
Check Database Connection Limits
Every database has a maximum number of allowed connections. If multiple application instances, admin tools, workers, cron jobs, and background processes connect at the same time, you may reach that limit.
Check your current database sessions and identify whether idle sessions, blocked queries, or application leaks are consuming available connections. You may need to reduce app pool sizes across multiple servers rather than increasing the database limit blindly.
Check Slow Queries and Database Locks
Slow queries can keep connections busy for too long. A pool may appear empty even though connections technically exist, because every connection is waiting on a slow query, lock, deadlock, missing index, overloaded disk, or external dependency.
Review slow query logs, active sessions, blocking queries, database CPU usage, memory pressure, and lock waits. Fixing one inefficient query can remove the pressure that caused your pool to drain.
Use Lazy Connection Fetching When Suitable
Modern Spring Boot versions support lazy JDBC connection fetching for pooled data sources. This means a connection is acquired only when the application actually needs to create and run a JDBC statement, instead of being borrowed at the beginning of every transaction. :contentReference[oaicite:5]{index=5}
This can help reduce unnecessary connection usage in applications that start transactions but do not always execute database work. Test it carefully before enabling it in production because behavior can vary depending on your transaction design and framework integrations.
Common Problems and Quick Fixes
Pool Is Empty After Deploying a New Version
Check whether your deployment platform replaced environment variables, secrets, database URLs, or SSL settings. Compare the active production variables against the previous working deployment.
Pool Is Empty Only During High Traffic
Look for slow queries, connection leaks, long transactions, undersized pool settings, and too many simultaneous background jobs. Do not increase the pool until you understand how many database connections your database can safely handle.
Pool Is Empty After Database Restart
Old connections may be invalid after the database comes back online. Restart the app or ensure your pool properly validates and replaces failed connections.
Pool Is Empty in Docker but Works Locally
Replace localhost with the correct database service hostname. Confirm both containers are on the same Docker network and the database port is exposed internally.
Pool Is Empty on Cloud Hosting
Check database allowlists, VPC settings, security groups, private networking, SSL requirements, rotating credentials, and whether the provider pauses inactive databases.
Frequently Asked Questions
What does pool is empty failed to create setup connection mean?
It means your application’s database connection pool has no healthy connections available, and it also failed while trying to create a replacement connection. The root cause is usually a database, credentials, network, SSL, or pool exhaustion issue.
Can increasing maximum pool size fix connection pool errors?
Sometimes, but only when your database is healthy and the app genuinely needs more concurrent connections. Increasing pool size will not fix invalid credentials, firewall blocks, database downtime, connection leaks, or slow queries.
Why does HikariCP say pool is empty?
HikariCP says the pool is empty when no usable database connection is available to borrow. It then tries to create a new connection. If that creation attempt fails, you see the failed connection setup message.
Try connecting to the database manually from the same server or container where your application runs. If the direct command fails, the issue is likely database access, networking, credentials, or server availability. If it works, review your application URL, driver, SSL options, and pool configuration.
Should I restart my application after fixing database credentials?
Yes. Restarting the application forces the pool to discard failed connection attempts and initialize again with the corrected credentials or connection settings.
Final Thoughts
The Login Pool Is Empty and Connection Creation Failed error is frustrating because it can make your entire application appear offline. However, the fix is usually straightforward once you stop treating it as only a connection pool problem.
Start by reading the actual database error below the pool warning. Then verify direct connectivity from the application server, confirm the database URL and credentials, check firewall and cloud access rules, and finally tune the pool only after the core connection works.
In most cases, the real solution is one of these: correcting the database host, updating expired credentials, allowing the app server IP, restoring the database service, fixing SSL mode, reducing connection leaks, or optimizing slow database activity. Once those issues are resolved, your connection pool can create healthy connections again and the application should return to normal.
ALSO READ:








