views:

212

answers:

1

I'd like to set the v$session.program Oracle property in order to have information available in the session table. I'm using JPA with a jndi XA datasource created with an oracle-xa-ds.xml deployed in the deploy folder of Jboss, and therefore I haven't access to the constructor of the Connection. I have access to the Connection object, in JPA 2 using unwrap, in JPA 1 by casting JPA to Hibernate classes, but there are no properties setter (only Client Info properties that are the way to proceed starting JDBC 4.0).

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

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

Thank you for any valuable comments and answers !

A: 

I'm pretty sure this must be documented somewhere but here is what we can find in the JBoss wiki:

How To Specify "PROGRAM" Oracle Connection Property

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

To be able to distinguish the JDBC connections on the Oracle server side, which are created by different JBoss instances, Oracle's PROGRAM connection property might be set within the Oracle specific JDBC datasource config file by using the following tags:

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

i.e.

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

That way the DBAs can have proper granularity in:

  • AWRs
  • v$session view
  • Other tools which are checking/evaluating PROGRAM connection property
Pascal Thivent
Thank you Pascal, I appreciate your answer, but unfortunately the connection-property is not available for XA datasources. For XA datasources, only the xa-datasource-property markup is available, and can only configure properties that are available as attributes of the XADataSource JavaBeans. I just found a mate with the same problem http://community.jboss.org/message/227607#227607
snowflake
@snowflake: Erf, didn't pay attention to the fact you are using XA. Will need to dig this more... if you don't implement a patch as suggested by the link :)
Pascal Thivent
@Pascal Thivent: I hope I'll get a chance to test it on Jboss 5 or more, then I'll effectively consider implementing the patch !
snowflake