Package org.apache.derby.diag
Class ErrorLogReader
java.lang.Object
org.apache.derby.vti.VTITemplate
org.apache.derby.diag.ErrorLogReader
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
,AwareVTI
ErrorLogReader is a virtual table interface (VTI) which contains all the statements
of "interest" in db2j.log or a specified file when
db2j.language.logStatementText=true.
One use of this VTI is to determine the active transactions and the SQL statements in those transactions at a given point in time, say when a deadlock or lock timeout occurred. In order to do that, you must first find the timestamp (timestampConstant) of interest in the error log. The SQL to view the active transactions at a given in time is:
SELECT vti.ts, threadid, cast(xid as int) as xid_int, cast(lccid as int) as lccid_int, logtext FROM new org.apache.derby.diag.ErrorLogReader() vti, (VALUES timestampConstant) t(ts) WHERE vti.ts <= t.ts AND vti.ts > (SELECT MAX(ts) IS NULL ? '2000-01-01 00:00:00.1' : MAX(ts) FROM new org.apache.derby.diag.ErrorLogReader() vti_i WHERE (logtext LIKE 'Committing%' OR logtext LIKE 'Rolling%') AND vti.xid = vti_i.xid AND ts < t.ts) ORDER BY xid_int, vti.ts
The ErrorLogReader virtual table has the following columns:
- TS varchar(26) - the timestamp of the statement.
- THREADID varchar(40) - the thread name.
- XID varchar(15) - the transaction ID.
- LCCID varchar(15) - the connection ID.
- DATABASE varchar(128) - Database name
- DRDAID varchar(50) - nullable. DRDA ID for network server session.
- LOGTEXT long varchar - text of the statement or commit or rollback.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.derby.vti.VTITemplate
VTITemplate.ColumnDescriptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
private BufferedReader
private static final ResultColumnDescriptor[]
private int
private int
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private int
private boolean
private String
private InputStreamReader
private InputStream
private int
private String
private static final ResultSetMetaData
private static final String
private int
private int
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
-
Constructor Summary
ConstructorsConstructorDescriptionErrorLogReader() accesses the derby.log in derby.system.home, if set, otherwise it looks in the current directory.ErrorLogReader
(String inputFileName) -
Method Summary
Methods inherited from class org.apache.derby.vti.VTITemplate
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getContext, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getReturnTableSignature, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isWrapperFor, last, moveToCurrentRow, moveToInsertRow, notImplemented, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setContext, setFetchDirection, setFetchSize, unwrap, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.ResultSet
updateObject, updateObject, updateObject, updateObject
-
Field Details
-
gotFile
private boolean gotFile -
inputFileStreamReader
-
inputStream
-
bufferedReader
-
inputFileName
-
line
-
endTimestampIndex
private int endTimestampIndex -
threadIndex
private int threadIndex -
xidIndex
private int xidIndex -
lccidIndex
private int lccidIndex -
databaseIndex
private int databaseIndex -
drdaidIndex
private int drdaidIndex -
END_TIMESTAMP
- See Also:
-
PARAMETERS_STRING
- See Also:
-
BEGIN_THREAD_STRING
- See Also:
-
END_THREAD_STRING
- See Also:
-
BEGIN_XID_STRING
- See Also:
-
END_XID_STRING
- See Also:
-
BEGIN_DATABASE_STRING
- See Also:
-
END_DATABASE_STRING
- See Also:
-
BEGIN_DRDAID_STRING
- See Also:
-
END_DRDAID_STRING
- See Also:
-
BEGIN_EXECUTING_STRING
- See Also:
-
END_EXECUTING_STRING
- See Also:
-
columnInfo
-
metadata
-
-
Constructor Details
-
ErrorLogReader
ErrorLogReader() accesses the derby.log in derby.system.home, if set, otherwise it looks in the current directory. ErrorLogReader('filename') will access the specified file name.- Throws:
StandardException
-
ErrorLogReader
- Throws:
StandardException
-
-
Method Details
-
getMetaData
- Specified by:
getMetaData
in interfaceResultSet
- Overrides:
getMetaData
in classVTITemplate
- See Also:
-
next
- Throws:
SQLException
- If database-access error occurs.- See Also:
-
close
public void close()- See Also:
-
getString
All columns in the Db2jLogReader VTI have a of String type.- Specified by:
getString
in interfaceResultSet
- Overrides:
getString
in classVTITemplate
- Throws:
SQLException
- If database-access error occurs.- See Also:
-
wasNull
public boolean wasNull()- Specified by:
wasNull
in interfaceResultSet
- Overrides:
wasNull
in classVTITemplate
- See Also:
-