I have a Spring Boot 1.4.7 application that I am currently updating to version 2.0.5. The application connects to an Oracle DB using JDBC using the following configuration:
spring:
jpa:
database-platform: org.hibernate.dialect.Oracle12cDialect
datasource:
url: jdbc:oracle:thin:@<db_server>
username: ${credentials.database.username}
password: ${credentials.database.password}
driver-class: oracle.jdbc.OracleDriver.class
platform: oracle
tomcat:
connection-properties: v$session.program=${spring.application.name}
After updating the application to Spring Boot 2.0.5 the application name sent to the server is JDBC Thin Client
instead of ${spring.application.name}
. The reason for this seems to be the switch to HikariCP as the default connection pool in Spring 2.x. How would I migrate this configuration to Hikari in a way that allows me to send a custom property for v$session.program
to the db?
What I have tried:
?ApplicationName=<name>
to the JDBC url.System.setProperty("oracle.jdbc.v$session.program", <name>)
spring.datasource.hikari.data-source-properties.v$session.program: <name>
in the application.yml"HikariCP is solid high-performance JDBC connection pool. A connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required. Connection pools may significantly reduce the overall resource usage." - You can find out more here.
Hikari is a JDBC DataSource implementation that provides a connection pooling mechanism. Compared to other implementations, it promises to be lightweight and better performing.
In yaml, the dollar sign is escaped.
spring.datasource.hikari.data-source-properties.v$session.program: <name>
com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>, vsession.program=<name>}
Try this.
spring:
datasource:
hikari:
data-source-properties: v$session.program=name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With