1

When I want to use a Mysql database in a Springboot app, I am able to create it on start via a string in properties similar to this:

spring.datasource.jdbc-url=jdbc:mysql://localhost:3306/testDb?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

Nevertheless PostgreSQL seems to ignore this:

spring.datasource.jdbc-url=jdbc:postgresql://localhost:5432/testdb?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

Is there a way to create a PostgreSQL db on start of a SpringBoot app before Flyway attempts to initiate tables?

1 Answer 1

2

Postgres doesn't support creating a database on demand via the JDBC URL. You can learn about what configuration is possible in the documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.