Spring Boot 1.3.5 with Hikari Connection Pool not able to set program name in v$session
Asked Answered
D

2

3

I have a JHipster spring boot ver 1.3.5 application which connects to Oracle DB using Hikari Connection Pool. I am unable to set the program in v$session which should be possible by adding below in my application YAML

hikari:
   v$session:
     program: AppName
     username: DB_USER

I have tried adding these at spring.datasource level, datasource.hikari level and datasource level.

I also looked at Hibernate 4.3.5 ignores v$session.program configuration property but that did not work as well.

Update 1 - I tried all the below and none seem to work

spring.datasource.hikari.datasourceProperties.v$session.program AppName
spring.datasource.hikari.datasourceProperties.v$session.username    DB_USER
datasource.hikari.v$session.program AppName
datasource.hikari.v$session.username    DB_USER
datasource.hikari.datasourceProperties.v$session.program    AppName
datasource.hikari.datasourceProperties.v$session.username   DB_USER
hikari.v$session.program    AppName
hikari.v$session.username   DB_USER
hikari.datasourceProperties.v$session.program   AppName
hikari.datasourceProperties.v$session.username  DB_USER
Determined answered 13/12, 2016 at 19:55 Comment(3)
Well that property doesn't exists for Spring Boot to do Hikari configuration so that indeed will not work. I would expect something like spring.datasource.hikari.v$session.program on the other hand to work. Or by prefixing it with spring.datasource.hikari.datasourceProperties.Selfdiscipline
@M.Deinum I tried the above (see Update 1) and none seem to work.Determined
I am able to get it to work if I use HikariConfig (setDataSourceProperties) instead of Spring Boot DataSourceBuilderDetermined
H
2

In Spring Boot 2 use:

spring:
  datasource:
    hikari:
      data-source-properties:
        "[v$session.program]": AppName
Hydrolytic answered 11/12, 2022 at 18:1 Comment(0)
D
0

Following works in Spring Boot 1.5.8.RELEASE using application.yml file:

spring:
  datasource:
    hikari:
      data-source-properties:
         v$session.program: AppName
Dickson answered 14/3, 2018 at 13:25 Comment(1)
Thank you! Finally a solution... spent a day on this.Violoncellist

© 2022 - 2024 — McMap. All rights reserved.