Luis Sergio Faria Carneiro created CAMEL-22927:
--------------------------------------------------
Summary: camel-sql endpoint opening unnecessary connections to the
database if service locatio is enabled
Key: CAMEL-22927
URL: https://issues.apache.org/jira/browse/CAMEL-22927
Project: Camel
Issue Type: Improvement
Components: camel-sql
Affects Versions: 4.17.0
Reporter: Luis Sergio Faria Carneiro
The sql/sql-stored components may open unnecessary connections to the database
if service location is enabled.
We faced an issue where we are using Apache Commons DBCP
[BasicDataSource|https://github.com/apache/commons-dbcp/blob/master/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java#L1090].
During the sql component initialization phase, it would get the properties
from that class, which includes {{{}getLogWriter(){}}}.
This method creates a real connection to the database which is not needed for
the purposes of service location, as it is interested only in jdbc url and
username.
And it got worse in a scenario where an Azure MySQL Database was stopped. Each
connection attempt was taking 2+ minutes to finish as no timeout was configured
in the connection url. Having a few sql endpoints on my route caused the camel
context to take more than 10 minutes to start.
The purpose here is to adjust the component so that it only reads the necessary
properties.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)