8

I have a Java application which needs to be audited (so obviously I need a way in which the app can be identified with the application name). I googled and found that ojdbc14 has the method .setClientInfo which allows registering the application with a customized name, so I am trying to get it work but I get the following error:

Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setClientInfo(Ljava/lang/String;Ljava/lang/String;)V

I am using ojdbc14 with oracle 10g express. If I do not set the line:

connection.setClientInfo("ApplicationName","Customers");

it works pretty well ....and by checking the audit info I can see that oracle gets the application name:OS_program_name=JDBC Thin Client, but I need a way to change it for a customized name.

By uncommenting that line which is supposed to set the application name it returns the error above.

Per oracle documentation that method is available for a Connection object. Do you have any idea how to solve this issue?

trooper
  • 4,444
  • 5
  • 32
  • 32
Alvaro Castro
  • 199
  • 1
  • 4
  • 22

1 Answers1

13

For AbstractMethodError, please check Why do I get java.lang.AbstractMethodError when trying to load a blob in the db?

In order to distinguish your connections in Oracle you can use this sample code below:

Properties jdbcProperties = new Properties();

this.jdbcProperties.put("user", userName);
this.jdbcProperties.put("password", password);
this.jdbcProperties.put("v$session.program", "YourApplicationName");
DriverManager.getConnection(url, jdbcProperties);

then check v$session by grouping against program column for your connections..

Community
  • 1
  • 1
gokhant
  • 96
  • 1
  • 3
  • i really appreciate your help man this was really helpful to me...i applied the lines you gave me and it works fine....thanks a lot, sincerely. – Alvaro Castro May 20 '10 at 20:44
  • Glad to hear that it worked. One more thing though, this code won't work when you're using oci urls to connect to your Oracle db. It works for just thin urls, I don't understand Oracle about this. At this point you may use DBMS_APPLICATION_INFO package to set module name and action to trace your applications. – gokhant May 21 '10 at 03:17