How to resolve the "Failed to initialize pool: ONS configuration failed" error

Learn how to fix the error that occurs when a Java application cannot connect to an Oracle database.

If you try to connect a Java application to the Oracle database, you may receive the following error message:

"Could not establish connection to the database. Error com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: ONS configuration failed"

Identifying the cause of the error

This error is caused by incorrect settings of the Oracle Notification Service (ONS). This service notifies the application of database changes, but inadequate configuration can break connectivity and cause this issue.

Fixing the error

To resolve this error, disable the ONS function by adding a specific parameter to the configuration of your connector. Follow the steps below:

  1. Open the configuration of a database connector (normally the DB connector is used in these cases).

  2. Find the parameter that contains the configuration of the Oracle database.

  3. Add the following line to disable ONS: "oracle.jdbc.fanEnabled" : false

Example of configuration.
  1. Save the connector and test the execution.

If the configuration is correct, the database connection should now be successful.

Was this helpful?