Reputation: 19
this is my application.properties ,which is configured to hold two db configs so we can run two separately ,one with default db ,second as test for everyday use
quarkus.datasource.db-kind=oracle
quarkus.datasource.username=****_res_test
quarkus.datasource.password=******************$v0yoxh
quarkus.datasource.jdbc.url=jdbc:oracle:thin:@*****-nat.*****.net:3330:*****
%test.quarkus.datasource.db-kind=h2
%test.quarkus.datasource.username=sa
%test.quarkus.datasource.password=password
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
I have added these dependencies,one for default db as oracle second for h2
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-oracle</artifactId>
<version>3.8.1</version>
</dependency>
when I run ./mvnw quarkus:dev -Dquarkus.profile=test
I'm having the following error after trying
Caused by: io.quarkus.runtime.configuration.ConfigurationException: Unable to find a JDBC driver corresponding to the database kind 'h2' for the default datasource (available: 'oracle'). Check if it's a typo, otherwise provide a suitable JDBC driver extension, define the driver manually, or disable the JDBC datasource by adding 'quarkus.datasource.jdbc=false' to your configuration if you don't need it.
I tried to set this "quarkus.datasource.jdbc=false" then run , but after i do so i get this time
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#configurationDescriptorBuilding threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Datasource must be defined for persistence unit ''.
so after trying and trying couldn't get this running ,please help.
Upvotes: 0
Views: 85
Reputation: 96
So based on this link you can see that for what you want to do you could use
%dev.quarkus.datasource.db-kind=h2
%dev.quarkus.datasource.username=sa
%dev.quarkus.datasource.password=password
%dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
so when you run ./mvnw quarkus:dev
your application will use those setting.
The %test
is active when running tests. (If I'm not mistaken to have this you could do ./mvnw verify etc...)
If you want to use Oracle for production, I believe you could use %prod which is "The default profile when not running in development or test mode"
Hope it helps 🤘
Upvotes: 1