helidon-io / helidon

Java libraries for writing microservices
https://helidon.io
Apache License 2.0
3.5k stars 566 forks source link

DBClient should allow to set Datasource class #3394

Open arjav-desai opened 3 years ago

arjav-desai commented 3 years ago

Currently, when we config DB client, we provide "source" which picks up "HikariCP" and sets jdbcUrl on "HikariConfig" based on "connection:url".

Based on https://github.com/brettwooldridge/HikariCP#essentials and looking at code, it seems to be using DriverManager based DS i.e. java/com/zaxxer/hikari/util/DriverDataSource.java. We should expose driver/factory className property, just like we do for MP.

tomas-langer commented 3 years ago

We do not allow using a different connection pool in MP based on a property. You need to choose the correct implementation (a module) - either UCP or Hikari. Then you specify the driver to use using the class name (same as in Helidon SE).

jdbc implementation of DbClient is based on Hikari as a design choice. If we want to support other data source, we have the following options:

What is the use case to use a different library?

ljnelson commented 3 years ago

The issue is that by providing support only for Hikari's jdbcUrl property and not its dataSourceClassName property we are not allowing the Hikari connection pool to function to its full potential. See the first two configuration properties in this list: we currently only specify the second one.