Method setClientIdentifier() Not Found In Interface oracle.jdbc.OracleConnection for JDBC 10g [ID 369236.1] | |||||
Modified 27-MAY-2009 Type PROBLEM Status MODERATED |
In this Document
Symptoms
Cause
Solution
This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process, and therefore has not been subject to an independent technical review. |
As the method setClientIdentifier is deprecated, it is necessary to use an alternative method for
metric purposes as described in the documentation.
It can be used the new method setEndToEndMetrics as indicated in the documentation.
Oracle® Database
JDBC Developer’s Guide and Reference
10g Release 2 (10.2)
http://download-west.oracle.com/docs/cd/B19306_01/java.102/b14355.pdf
page 30-1.
Sample code:
import java.io.IOException;
import java.sql.*;
import oracle.jdbc.OracleConnection;
public class vSession
{
public vSession()
{
}
public static void main(String[] args)
{
vSession vSession = new vSession();
try
{
// Load the Oracle JDBC driver
// Change the following code line to reflect a valid connection to your
// server
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@mhernand-us2.us.oracle.com:1521:V102010";
java.util.Properties prop = new java.util.Properties();
prop.put("user","scott");
prop.put("password","tiger");
prop.put("v$session.program","jdbc thin driver");
prop.put("v$session.osuser","Mike");
java.sql.Connection conn = (new oracle.jdbc.OracleDriver()).connect(url,prop);
String[] metrics = new String[OracleConnection.END_TO_END_STATE_INDEX_MAX];
metrics[OracleConnection.END_TO_END_CLIENTID_INDEX]="module-name";
((OracleConnection)conn).setEndToEndMetrics(metrics,(short)0);
// make a network roundtrip make sure the module name is updated
// since, end2end tracing is a piggy back message.
Statement stmt = conn.createStatement ();
stmt.executeQuery ("SELECT USER FROM DUAL");
System.in.read(); // => This line is just to stop until you press enter.
// Before you hit enter you can execute the next select statment to check
// this information in the v$session.
//
// select osuser, program, client_identifier
// from v$session;
//
System.out.println("\n=============");
}
catch (SQLException e)
{
e.printStackTrace();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
Related Products
|