Skip Headers

Oracle® Database JDBC Developer's Guide and Reference
10g Release 1 (10.1)

Part Number B10979-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

21 End-To-End Metrics Support

Oracle JDBC now supports end-to-end metrics when used with an Oracle 10g database. This chapter discusses end-to-end metric support. It contains the following sections:

21.1 Introduction

JDBC supports four end-to-end metrics, all of which are set on a per-connection basis:

All of these metrics are set on a per-connection basis. All operations on a given connection share the same values. Applications normally set these metrics using DMS; although it is also possible to set metrics using JDBC, metrics set using DMS (Dynamic Monitoring Service) override metrics set using JDBC. To use DMS directly, you must be using a DMS-enabled JAR, which is only available as part of Oracle Application Server.


Note:

If you are using a DMS-enabled JDBC JAR file, then you must include the JAR file for DMS itself (dms.jar) in your CLASSPATH. The DMS-enabled JDBC JAR file and the DMS JAR file must come from the same Oracle release.

Table 21-1 Maximum Lengths for End-to-End Metrics

Metric Maximum length
ACTION 32
CLIENTID 64
ECID (string component) 64
MODULE 48

When a connection is created, the JDBC drivers check DMS for end-to-end metrics. It only makes this check once during the lifetime of the connection.

21.2 JDBC API For End-To-End Metrics

If DMS is not in use, either because a non-DMS JAR is in use or because no metric values were set in DMS, the JDBC API is used.

The JDBC API defines the following constants and methods on OracleConnection:

To unset the metrics, pass an array of appropriate size with all null values and the value Short.MIN_VALUE as the sequence number.

Example 21-1 Using the JDBC API for End-to-end Metrics

ods.setUrl(
"jdbc:oracle:oci:@(DESCRIPTION=
  (ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias)
    (PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME=service_name)))");
ods.setUser("scott");
Connection conn = ods.getConnection();  

String metrics[] = new String[OracleConnection.END_TO_END_STATE_INDEX_MAX];
metrics[END_TO_END_ACTION_INDEX] = "Spike";
metrics[END_TO_END_MODULE_INDEX] = "Buffy";
// Set these metrics
conn.setEndToEndMetrics(metrics, (short) 0);
// Do some work
// Update a metric
metrics[END_TO_END_MODULE_INDEX] = "Faith";

conn.setEndToEndMetrics(metrics, (short) 0);
// Retrieve metrics
new String[] newMetrics = conn.getEndToEndMetrics();