Repository navigation
Replies: 2 comments 1 reply
|
Two separate problems here, and together they explain both symptoms. 1. Why the postgres profile still fails with "Driver does not support the provided URL"
Your default (unnamed) datasource has 2. Why removing the default datasource breaks the build entirely Your What actually fixes this
Since each customer runs one fixed provider, the first option is likely the least code and gets you an ordinary single-persistence-unit Panache setup per artifact. |
Uh oh!
There was an error while loading. Please reload this page.
Hi, this is my first post here, but I have been using Quarkus for a while now. A quick background of our app is that we are porting a legacy Java app that is utilizing Hibernate and Spring Framework (with Spring Data JPA) to Quarkus. We have chosen to implement Hibernate ORM with Panache to support REST resources accessed from an Angular front end. Our business model is such that we support customers who can run with any one of a select list of database providers (currently Oracle, PostgreSQL, DB2 and MySQL). As such, we would like to be as efficient and flexible as we can with our build configurations so we can deliver something our customers can easily configure and run.
With that said, and having looked at the example in the datasource configuration guide (https://quarkus.io/guides/datasource#configure-multiple-datasources) as well as the hibernate-orm configuration guide (https://quarkus.io/guides/hibernate-orm#multiple-persistence-units), my goal is to configure our project to support multiple datasources that can be started by using the
-Dquarkus.profile={profile-name}parameter.Right now, I have it configured with a default configuration (I think) and two profiles - one for Oracle and one for Postgres:
default config
quarkus.datasource.db-kind=oracle
quarkus.datasource.jdbc.url=jdbc:oracle:thin:@xxxxxxxx:1521:xxxxxxx
quarkus.datasource."oracle".active=false
quarkus.datasource."postgres".active=false
.
.
quarkus.hibernate-orm.database.default-schema=xxxxxxxx
quarkus.hibernate-orm."oracle".active=false
quarkus.hibernate-orm."postgres".active=false
quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.log.sql=false
quarkus.hibernate-orm.packages=com.abc.def.model
oracle profile
%oracle.quarkus.datasource.db-kind=oracle
%oracle.quarkus.datasource."oracle".active=true
%oracle.quarkus.datasource.jdbc.url=jdbc:oracle:thin:@xxxxxxxx:1521:xxxxxxx
.
.
%oracle.quarkus.hibernate-orm.database.default-schema=xxxxxxxx
%oracle.quarkus.hibernate-orm."oracle".active=true
%oracle.quarkus.hibernate-orm.database.generation=none
%oracle.quarkus.hibernate-orm.log.sql=false
%oracle.quarkus.hibernate-orm.packages=com.abc.def.model
postgres profile
%postgres.quarkus.datasource.db-kind=postgresql
%postgres.quarkus.datasource."postgres".active=true
%postgres.quarkus.datasource.jdbc.url=jdbc:postgresql://xxxxxxxxxx:5432/xxxx
.
.
%postgres.quarkus.hibernate-orm."postgres".active=true
%postgres.quarkus.hibernate-orm.database.generation=none
%postgres.quarkus.hibernate-orm.log.sql=false
%postgres.quarkus.hibernate-orm.database.default-schema=xxxxxxxx
%postgres.quarkus.hibernate-orm.packages=com.abc.def.model
I run quarkus build, and then utilize the default fast-jar way of running the app locally on my Windows laptop. What is happening, when using the configuration shown above, is that if I set the default config's
db-kindproperty to 'oracle', I can run with eitherjava -jar quarkus-run.jarorjava -Dquarkus.profile=oracle -jar quarkus-run.jarand all is good - startup is clean and services are successfully accessing the Oracle db:However, if I then try running with the Postgres profile using
java -Dquarkus.profile=postgres -jar quarkus-run.jarI receive this error:I have tried removing the default configuration completely, thinking it is the reason the "non-matching" profile fails to start successfully, but then the build will not even complete - I receive the following build error:
Would anyone have a hint on what configuration I can use to accomplish my goals? Or if I am flat-out doing the wrong thing and there's an easier way? :)
All reactions