Configure JDBC Oracle specific property v $ session.program using Jboss and JPA (sleep mode)

I would like to set the v $ session.program property of Oracle to have available information in the session table. I am using JPA with a jndi XA data source created using oracle-xa-ds.xml deployed in a Jboss deployment folder and therefore I do not have access to the Connection constructor. I have access to the Connection object in JPA 2 by unpacking in JPA 1 by assigning the JPA to Hibernate classes, but there are no setter properties (only Client Info properties that allow JDBC 4.0 to continue to run).

So my question is using JPA (with Hibernate) using Jboss 4.2:

  • Is it possible to configure v $ session.program in persistence.xml file?
  • Is it possible to configure v $ session.program in oracle-ds.xml?
  • Do they have any other approach to the solution?

Thanks for the valuable comments and answers!

+3
source share
2 answers

I had the same problem today, after I spoke many times and realized that I had a moment of Eureka:

Add the following parameter:

<xa-datasource-property name="connectionProperties">v$session.program=YourUniqueName</xa-datasource-property>

That's all.

+1
source

I'm sure this should be documented somewhere, but here is what we can find on the JBoss wiki:

How to specify the PROGRAM property for Oracle Connection

JBoss Version: JBoss 4.0.3 SP1, Oracle DB Version: 10g

JDBC Oracle, JBoss , Oracle PROGRAM datasource JDBC Oracle , :

<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>

.

...
<connection-url>AConnectionURL</connection-url>
<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
...

, :

  • AWRs
  • v $session view
  • , / PROGRAM
+1

Source: https://habr.com/ru/post/1757680/


All Articles