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 applica开发者_Python百科tion 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?
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..
精彩评论