Unable to set default PostgreSQL DB using Dev Services & "devservices.jdbc.additional-jdbc-properties" config setting #32411
Replies: 3 comments 2 replies
-
/cc @geoand (devservices), @stuartwdouglas (devservices) |
Beta Was this translation helpful? Give feedback.
-
I just made a slight change to how I'm representing my config setting, by adding a dash before "%localhost":
quarkus:
swagger-ui:
always-include: true
enable: true
datasource:
localstorage:
devservices:
enabled: true
image-name: postgres:14.5
username: root
password: verysecure
db-name: potato_service
port: 87654
jdbc:
additional-jdbc-properties:
- search_path: potato_service If so, then here's the last question I have: how do I confirm the effective JDBC URL that Quarkus is using? Because after making the aforementioned change, this is still all I see in IntelliJ's "Console" tab, when Quarkus starts up:
If Quarkus is actually using my setting, I'd expect to see this instead (
|
Beta Was this translation helpful? Give feedback.
-
The initial error suggests you had some kind of identation issue in your YAML. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Dev Services + Flyway to automatically provision a PostgreSQL 14.5 database in a Quarkus 2.16.5.Final project, with IntelliJ (2023.1, Ultimate Edition) as my IDE. Here's my
application.yml
file:application.yml
When I startup the project in IntelliJ, Dev Services successfully provisions a PostgreSQL 14.5 database instance in a Docker container & runs my Flyway migration script (
V1680622059__CreateTables.sql
), which creates & populates several tables:When I connect to the database using DataGrip as my IDE, I see a schema named
potato_service
& a database inside it namedpotato_service
-- so far, so good! However, at this point, I'm unsure as to whether Quarkus is usingpotato_service
as both the datasource schema & database.What I'd like to do is explicitly set the PostgreSQL search_path, so that there's no question about what database is being used. It seems like this may be possible, by using an effective JDBC URL of
jdbc:postgresql://localhost:87654/potato_service?search_path=potato_service
, instead of thejdbc:postgresql://localhost:87654/potato_service
URL that Dev Services uses. There was a PR (#15749) that appears to have added support for this in March 2021, and there is code in themain
branch'sPostgresqlDevServicesProcessor.java
file that seems like it should do the trick. But I can't figure out what configuration setting I should be using for a custom Dev Services datasource inapplication.yml
.I took a look in the "All Configuration Settings" document and it seemed like quarkus.datasource."datasource-name".jdbc.additional-jdbc-properties would do the trick. However, when I update my
application.yml
file like so:I get the following warning when Quarkus starts up:
Am I doing something obviously wrong here, in how I'm trying to set the
quarkus.datasource.localstorage.jdbc.additional-jdbc-properties
value inapplication.yml
? Or am I setting the value correctly & Quarkus isn't seeing it?Beta Was this translation helpful? Give feedback.
All reactions