We are developing microservices using java (Spring and Spring Boot), and the access to our Oracle DB is done via the JDBC Oracle Driver.
The problem is that our DBAs can only see on the Oracle side that a "JDBC Thin Client" is connected. There is no better, logical representation of the connected application. Without such identification, it is hard to know which microservice might be behaving badly. Other non-JDBC clients identify themselves clearly with the hostname.
Is there any way to change the identification String so that it represents a clear identity of the source application/process?
Note: Our system runs on Cloud Foundry which uses containers, so a it's not really possible to provide a machine name or anything like that - a logical application name would be preferred.
Thanks
Connection URL: The connection URL for the oracle10G database is jdbc:oracle:thin:@localhost:1521:xe where jdbc is the API, oracle is the database, thin is the driver, localhost is the server name on which oracle is running, we may also use IP address, 1521 is the port number and XE is the Oracle service name.
You can find all users currently logged into Oracle by running a query from a command prompt. In Oracle/PLSQL, there is a system view called V$SESSION which shows the session information for each current session in the database.
As Oracle SQL Developer is a database, so with working with that everyone needs a JDBC driver installed on it.
select instance_name from v$instance; will give you SID name. select name from v$database; will give DB NAME. select instance_name from v$instance; will give you SID name.
The JDBC connection property "oracle.jdbc.v$session.process
" can be set (as a system prop -D) to a value that uniquely identifies your microservice and that can then be retrieved in the V$SESSION view ("process" column).
Thank you everyone for your suggestions, I have tried them all and sadly they did not work.
This is probably since I am connection using Spring Data and the default Hikari connection pool.
After spending hours on it, the final solution was found here: Spring Boot 1.3.5 with Hikari Connection Pool not able to set program name in v$session
spring:
datasource:
hikari:
data-source-properties:
v$session.program: AppName
Simple, no code changes, and it works!
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