2

Is it possible to add datasource url parameters as an extra property? Or do I always have to append them directly to the url as query parameters?

Example:

spring.datasource.url=jdbc:mysql://localhost/test?useSSL=false&tinyInt1isBit=false

I'd prefer adding them, pseudocode:

spring.datasource.url.meta.useSSL=false
spring.datasource.url.meta.tinyInt1isBit=false

Possible somehow?

membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • Which spring boot version and datasource are you using. – M. Deinum Sep 03 '18 at 11:04
  • I don't think that's possible. Check this out https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html find #DATASOURCE section. There are no more options after datasource.url – vanillaSugar Sep 03 '18 at 13:02
  • @M.Deinum I'm using most recent `spring-boot` version, and `mysql` as ds. – membersound Sep 03 '18 at 18:28
  • 1
    Mysql is your database NOT your DataSource. Need to know the implementation as with Hikari you can pass properties with spring.datasource.hikari.datasource-propertie.=value – M. Deinum Sep 03 '18 at 19:26
  • Sorry, you're right. `Hikari` is my ds. – membersound Sep 04 '18 at 07:26

1 Answers1

5

With the hint of @M. Deinum, the following works:

spring.datasource.hikari.data-source-properties.useSSL=false
spring.datasource.hikari.data-source-properties.tinyInt1isBit=false
membersound
  • 81,582
  • 193
  • 585
  • 1,120