-
Bug
-
Resolution: Done
-
Normal
-
3.8.0.GA
-
False
-
-
False
-
-
-
0
-
+
- The used datasource varies randomly if there are multiple datasource settings in application.properties with camel-sql
- For exmalple, default datasource and "sub" detasource are defined in the the following application.properties.
- In this case, the used datasource varies randomly each time Camel is started, e.g. sometimes the default datasource is used, other times the "sub" datasource is used, etc.
- My opinion is that the default datasource should always be used. This problem does not occur in the Red Hat build of Apache Camel 4.0. # application.properties quarkus.datasource.db-kind=postgresql quarkus.datasource.username=ceq-test quarkus.datasource.password=ceq-test quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/ceq01 quarkus.datasource."sub".db-kind=postgresql quarkus.datasource."sub".username=ceq-test quarkus.datasource."sub".password=ceq-test quarkus.datasource."sub".jdbc.url=$jdbc:postgresql://localhost:5432/ceq02 # camel-sql route definition .to("sql:classpath:sql/example.sql&outputType=SelectOne"
Environment
- Red Hat Build of Apache Camel for Quarkus 4.4
- quarkus.platform.version: 3.8.5.redhat-00003
Workaround
Assign a name, e.g. 'main', to the default data source. And use it in the dataSource option in camel-sql.
# Default data source config quarkus.datasource."main".db-kind=postgresql # Additional datasource config quarkus.datasource."sub".db-kind=postgresql Then in the route, use the dataSource option: .to("sql:classpath:sql/example.sql?dataSource=#main")