diff --git a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLServiceBindingConverter.java b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLServiceBindingConverter.java index 3581833b507eae..c6efa6d8ff1742 100644 --- a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLServiceBindingConverter.java +++ b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLServiceBindingConverter.java @@ -13,6 +13,6 @@ public class MsSQLServiceBindingConverter implements ServiceBindingConverter { @Override public Optional convert(List serviceBindings) { return ServiceBinding.singleMatchingByType("sqlserver", serviceBindings) - .map(new DatasourceServiceBindingConfigSourceFactory.Jdbc()); + .map(new DatasourceServiceBindingConfigSourceFactory.Jdbc("jdbc:%s://%s%s;databaseName=%s")); } } diff --git a/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleServiceBindingConverter.java b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleServiceBindingConverter.java index 387ab63f672128..c59060078fc020 100644 --- a/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleServiceBindingConverter.java +++ b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleServiceBindingConverter.java @@ -13,7 +13,7 @@ public class OracleServiceBindingConverter implements ServiceBindingConverter { @Override public Optional convert(List serviceBindings) { return ServiceBinding.singleMatchingByType("oracle", serviceBindings) - .map(new DatasourceServiceBindingConfigSourceFactory.Jdbc()); + .map(new DatasourceServiceBindingConfigSourceFactory.Jdbc("jdbc:%s:thin:@%s%s/%s")); } } diff --git a/extensions/jdbc/jdbc-oracle/runtime/src/main/resources/META-INF/services/io.quarkus.kubernetes.service.binding.runtime.ServiceBindingConverter b/extensions/jdbc/jdbc-oracle/runtime/src/main/resources/META-INF/services/io.quarkus.kubernetes.service.binding.runtime.ServiceBindingConverter new file mode 100644 index 00000000000000..9b1d88820b117f --- /dev/null +++ b/extensions/jdbc/jdbc-oracle/runtime/src/main/resources/META-INF/services/io.quarkus.kubernetes.service.binding.runtime.ServiceBindingConverter @@ -0,0 +1 @@ +io.quarkus.jdbc.oracle.runtime.OracleServiceBindingConverter diff --git a/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java b/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java index 190e83426e53e1..c667b637c95903 100644 --- a/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java +++ b/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java @@ -47,6 +47,12 @@ private Map getServiceBindingProperties() { log.debugf("Property 'password' was not found for datasource of type %s", serviceBinding.getType()); } + String url = bindingProperties.get("jdbc-url"); + if (url != null) { + properties.put(urlPropertyName, url); + return properties; + } + String host = bindingProperties.get("host"); String port = bindingProperties.get("port"); String database = bindingProperties.get("database"); @@ -72,11 +78,19 @@ public static class Jdbc extends DatasourceServiceBindingConfigSourceFactory { public Jdbc() { super("jdbc", "quarkus.datasource.jdbc.url", "jdbc:%s://%s%s/%s"); } + + public Jdbc(String urlFormat) { + super("jdbc", "quarkus.datasource.jdbc.url", urlFormat); + } } public static class Reactive extends DatasourceServiceBindingConfigSourceFactory { public Reactive() { super("reactive", "quarkus.datasource.reactive.url", "%s://%s%s/%s"); } + + public Reactive(String urlFormat) { + super("reactive", "quarkus.datasource.reactive.url", urlFormat); + } } } diff --git a/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OracleServiceBindingConverter.java b/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OracleServiceBindingConverter.java index 3879fedcd065fb..312ae604b9965f 100644 --- a/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OracleServiceBindingConverter.java +++ b/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OracleServiceBindingConverter.java @@ -13,7 +13,7 @@ public class OracleServiceBindingConverter implements ServiceBindingConverter { @Override public Optional convert(List serviceBindings) { return ServiceBinding.singleMatchingByType("oracle", serviceBindings) - .map(new DatasourceServiceBindingConfigSourceFactory.Reactive()); + .map(new DatasourceServiceBindingConfigSourceFactory.Reactive("%s:thin:@%s%s/%s")); } }