12 Replies Latest reply on Aug 19, 2013 2:32 PM by Bored Elf

    JBoss Connection Pool + Oracle End-To-End Metrics

    Bored Elf Newbie

      Hello there!


      I'm in a dire need of a hand/advice/tip/whatever you guys can give about my situation. Any insight is much appreciated. I may even be way over my head and knowledge (I'm a beginner in my team of Architects). I was assigned a task and I'm trying everything I can to see it done or at least, thoroughly researched, so I really thank you for any support I can get.


      At my workplace we want to improve the data obtained by Oracle Audit Vault by providing more accurate information about the database connections used in our applications, like the logged in user using the application. The idea is to intercept the moment when the application get a connection from the pool, and inject the metrics data. Then, when the connection is released, intercept again and clean the fields in which the data was injected.


      We can do this manually (inject the metrics data), in a simple main method, for instance:


      import java.sql.DriverManager;

      import java.sql.ResultSet;

      import java.sql.Statement;


      import oracle.jdbc.driver.OracleConnection;

      import oracle.jdbc.driver.OracleDriver;


      public class Test {

                public static void main(String[] args) throws Exception {

                          String url = "connection_url";

                          String user = "user";

                          String pass = "password";

                          DriverManager.registerDriver(new OracleDriver());

                          OracleConnection cnx = (OracleConnection) DriverManager.getConnection(url, user, pass);


                          String metrics[] = new String[OracleConnection.END_TO_END_STATE_INDEX_MAX];

                          metrics[OracleConnection.END_TO_END_ACTION_INDEX] = "Simple Test";

                          metrics[OracleConnection.END_TO_END_MODULE_INDEX] = "Test Application";

                          metrics[OracleConnection.END_TO_END_CLIENTID_INDEX] = "User ID";

                          // Set these metrics

                          cnx.setEndToEndMetrics(metrics, (short) 0);


        // Check if the metrics are there

                          Statement statement = cnx.createStatement();

                          ResultSet rs = statement.executeQuery("select sysdate, sys_context('USERENV','ACTION'), sys_context('USERENV','MODULE'), " +

                          "sys_context('USERENV','CLIENT_IDENTIFIER') from dual");


                          System.out.println(rs.getString(1) + " – " + rs.getString(2) + ", " + rs.getString(3) + ", " + rs.getString(4));








      So, that's my question: Is it possible? If it is, what should I do?