Configuring Client Information in JDBC for Oracle

I have a Java application that needs to be verified (so obviously I need the application to be identified with the name of the application). I googled and found that ojdbc14 has a method .setClientInfothat allows you to register an application with a custom name, so I'm trying to get it working, but I get the following error:

An exception in the thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setClientInfo (Ljava / languages ​​/ String; Ljava / languages ​​/ String;)

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

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

it works very well .... and, checking the audit information, I see that oracle gets the application name: OS_program_name = JDBC Thin Client, but I need a way to change it for the configured name.

Uncommenting this line, which should set the application name, it returns the error above.

In oracle documentation, this method is available for the object Connection. You do not know how to solve this problem?

+5
source share
1 answer

For AbstractMethodError, please check Why am I getting java.lang.AbstractMethodError when I try to load a blob in db?

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);

v $session, .

+9

All Articles