Package oracle.jdbc

## Interface TraceEventListener.TraceContext

Enclosing interface:
  TraceEventListener

    public static interface TraceEventListener.TraceContext

Information about the round trip. Valid only for the duration of the call to `TraceEventListener.roundTrip(Sequence, TraceContext, Object)`. Provides limited ability to set state for the duration of the round trip.

### Method Summary

All Methods Instance Methods Abstract Methods
`java.lang.String` `actualSqlText()` Return the SQL text the driver is sending to the database, if any.
`DatabaseFunction` `databaseFunction()` Returns current roundtrip database function.
`java.lang.String` `databaseOperation()` Returns a short String describing the purpose of the round trip, e.g.
`java.lang.String` `getClientInfo​(java.lang.String name)` Get a single client info value.
`java.lang.String` `getConnectionId()` Returns the Connection id.
`java.lang.String` `getConnectionUrl()` Gets the connection URL.
`java.lang.String` `getDatabaseName()` Gets the database name.
`java.lang.String` `getInstanceName()` Gets the instance name.
`long` `getNumRows()` Gets the number of rows returned.
`java.lang.String` `getProtocol()` Gets the protocol.
`java.lang.String` `getSchema()` Gets the schema.
`java.lang.String` `getServerAddress()` Gets the server address.
`java.lang.String` `getServerPID()` Gets the server process id.
`int` `getServerPort()` Gets the server port.
`java.lang.String` `getServiceName()` Gets the service name.
`java.lang.String` `getSessionID()` Gets the session ID.
`java.lang.String` `getShardName()` Gets the shard name.
`java.lang.String` `getSqlId()` Returns the SQL ID of the executing Statement.
`java.lang.String` `getSqlType()` When executing a statements gets the type of the SQL statement
`java.lang.Throwable` `getThrowable()` If the round trip completed exceptionally, returns the throwable that caused the exception.
`java.lang.Boolean` `isCompletedExceptionally()` Returns true if this round trip completed exceptionally, in any way.
`boolean` `isConnectionClosed()` Retrieves whether the connection has been closed.
`java.lang.String` `originalSqlText()` Returns the original SQL text the user code passed to the driver, if any.
`void` `setClientInfo​(java.lang.String name, java.lang.String value)` Set the client info name, value pairs.
`java.lang.String` `tenant()` Return the current tenant (PDB) ID.
`java.lang.String` `user()` Return the current user ID.

### Method Detail

#### getConnectionId

    java.lang.String getConnectionId()

Returns the Connection id. This value is unique for each physical connection across all space and time.

Returns:
  the Connection id. May be `null`

#### databaseOperation

    java.lang.String databaseOperation()

Returns a short String describing the purpose of the round trip, e.g. one of the `DatabaseFunction`'s descriptions. This is the same as #databaseFunction().getDescription().

Returns:
  a short description of the purpose of the round trip.
Throws:
  `java.lang.IllegalStateException` - if the call to `TraceEventListener.roundTrip(Sequence, TraceContext, Object)` has ended.

#### databaseFunction

    DatabaseFunction databaseFunction()

Returns current roundtrip database function.

Returns:
  the database function.
Throws:
  `java.lang.IllegalStateException` - if the call to `TraceEventListener.roundTrip(Sequence, TraceContext, Object)`

#### originalSqlText

    java.lang.String originalSqlText()

Returns the original SQL text the user code passed to the driver, if any.

Returns:
  the original SQL text. May be `null`.

#### actualSqlText

    java.lang.String actualSqlText()

Return the SQL text the driver is sending to the database, if any. Most likely isn't the same as the original SQL, but can be.

Returns:
  the actual SQL text. May be `null`.

#### user

    java.lang.String user()

Return the current user ID. May not be the same as the user ID used to create the connection.

Returns:
  current user ID. May be `null`.

#### tenant

    java.lang.String tenant()

Return the current tenant (PDB) ID.

Returns:
  the current tenant ID. May be `null`.

#### getSqlId

    java.lang.String getSqlId()

Returns the SQL ID of the executing Statement. See `OracleStatement.getSqlId()`.

Returns:
  the SQL ID, if the executing database operation is a SQL Statement. null otherwise.

#### isCompletedExceptionally

    java.lang.Boolean isCompletedExceptionally()

Returns true if this round trip completed exceptionally, in any way.

Returns:
  the round trip completion status. May be `null`.

#### setClientInfo

    void setClientInfo​(java.lang.String name,
                       java.lang.String value)
                throws java.sql.SQLClientInfoException

Set the client info name, value pairs. Names must be of the form <namespace>.<key>. Not all namespaces are supported.

Parameters:
  `the` - set of name, value pairs. Names must be namespace, key pairs
Throws:
  `java.sql.SQLClientInfoException` - if a name is of the wrong form or if the namespace is not supported

#### getClientInfo

    java.lang.String getClientInfo​(java.lang.String name)
                            throws java.sql.SQLException

Get a single client info value. The name must be of the form <namespace>:<key>. Not all namespaces are supported.

Parameters:
  `name` - namespace, key pair
Throws:
  `java.sql.SQLException` - if the connection is closed

#### isConnectionClosed

    boolean isConnectionClosed()

Retrieves whether the connection has been closed.

Returns:
  true if the connection is closed, otherwise false.

#### getThrowable

    java.lang.Throwable getThrowable()

If the round trip completed exceptionally, returns the throwable that caused the exception.

Returns:
  the Throwable that caused the round trip to complete exceptionally or null if the round trip did not finish exceptionally.

#### getServiceName

    java.lang.String getServiceName()

Gets the service name.

Returns:
  the service name. May be `null`.

#### getInstanceName

    java.lang.String getInstanceName()

Gets the instance name.

Returns:
  the instance name. May be `null`.

#### getServerPort

    int getServerPort()

Gets the server port.

Returns:
  the server port. May be `null`.

#### getServerAddress

    java.lang.String getServerAddress()

Gets the server address.

Returns:
  the server address. May be `null`.

#### getProtocol

    java.lang.String getProtocol()

Gets the protocol.

Returns:
  the protocol. May be `null`.

#### getSchema

    java.lang.String getSchema()

Gets the schema.

Returns:
  the schema. May be `null`.

#### getDatabaseName

    java.lang.String getDatabaseName()

Gets the database name.

Returns:
  the database name. May be `null`.

#### getSqlType

    java.lang.String getSqlType()

When executing a statements gets the type of the SQL statement

Returns:
  the type of the SQL statement. May be `null`.

#### getConnectionUrl

    java.lang.String getConnectionUrl()

Gets the connection URL.

Returns:
  the connection URL. May be `null`.

#### getShardName

    java.lang.String getShardName()

Gets the shard name.

Returns:
  the shard name. May be `null`.

#### getServerPID

    java.lang.String getServerPID()

Gets the server process id.

Returns:
  the process id. May be `null`.

#### getSessionID

    java.lang.String getSessionID()

Gets the session ID.

Returns:
  the session ID. May be `null`.

#### getNumRows

    long getNumRows()

Gets the number of rows returned.

Returns:
  the number of rows returned when executing a statement that return rows or fetching rows, otherwire zero.