public class ErrorLogReader extends VTITemplate
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:
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
BEGIN_DATABASE_STRING |
private static java.lang.String |
BEGIN_DRDAID_STRING |
private static java.lang.String |
BEGIN_EXECUTING_STRING |
private static java.lang.String |
BEGIN_THREAD_STRING |
private static java.lang.String |
BEGIN_XID_STRING |
private java.io.BufferedReader |
bufferedReader |
private static ResultColumnDescriptor[] |
columnInfo |
private int |
databaseIndex |
private int |
drdaidIndex |
private static java.lang.String |
END_DATABASE_STRING |
private static java.lang.String |
END_DRDAID_STRING |
private static java.lang.String |
END_EXECUTING_STRING |
private static java.lang.String |
END_THREAD_STRING |
private static java.lang.String |
END_TIMESTAMP |
private static java.lang.String |
END_XID_STRING |
private int |
endTimestampIndex |
private boolean |
gotFile |
private java.lang.String |
inputFileName |
private java.io.InputStreamReader |
inputFileStreamReader |
private java.io.InputStream |
inputStream |
private int |
lccidIndex |
private java.lang.String |
line |
private static java.sql.ResultSetMetaData |
metadata |
private static java.lang.String |
PARAMETERS_STRING |
private int |
threadIndex |
private int |
xidIndex |
| Constructor and Description |
|---|
ErrorLogReader()
ErrorLogReader() accesses the derby.log in
derby.system.home, if set, otherwise it looks in the current directory.
|
ErrorLogReader(java.lang.String inputFileName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
java.sql.ResultSetMetaData |
getMetaData() |
java.lang.String |
getString(int columnNumber)
All columns in the Db2jLogReader VTI have a of String type.
|
boolean |
next() |
boolean |
wasNull() |
getBigDecimal, getBigDecimal, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getObject, getShort, getString, getTime, getTimestampabsolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDouble, getFetchDirection, getFetchSize, getFloat, getInt, getLong, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getStatement, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, notImplemented, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestampclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHoldability, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getRowId, getRowId, getSQLXML, getSQLXML, isClosed, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateObject, updateObject, updateObject, updateObject, updateRowId, updateRowId, updateSQLXML, updateSQLXMLprivate boolean gotFile
private java.io.InputStreamReader inputFileStreamReader
private java.io.InputStream inputStream
private java.io.BufferedReader bufferedReader
private java.lang.String inputFileName
private java.lang.String line
private int endTimestampIndex
private int threadIndex
private int xidIndex
private int lccidIndex
private int databaseIndex
private int drdaidIndex
private static final java.lang.String END_TIMESTAMP
private static final java.lang.String PARAMETERS_STRING
private static final java.lang.String BEGIN_THREAD_STRING
private static final java.lang.String END_THREAD_STRING
private static final java.lang.String BEGIN_XID_STRING
private static final java.lang.String END_XID_STRING
private static final java.lang.String BEGIN_DATABASE_STRING
private static final java.lang.String END_DATABASE_STRING
private static final java.lang.String BEGIN_DRDAID_STRING
private static final java.lang.String END_DRDAID_STRING
private static final java.lang.String BEGIN_EXECUTING_STRING
private static final java.lang.String END_EXECUTING_STRING
private static final ResultColumnDescriptor[] columnInfo
private static final java.sql.ResultSetMetaData metadata
public ErrorLogReader()
throws StandardException
StandardExceptionpublic ErrorLogReader(java.lang.String inputFileName)
throws StandardException
StandardExceptionpublic java.sql.ResultSetMetaData getMetaData()
getMetaData in interface java.sql.ResultSetgetMetaData in class VTITemplateBaseResultSet.getMetaData()public boolean next()
throws java.sql.SQLException
next in interface java.sql.ResultSetnext in class VTITemplatejava.sql.SQLException - If database-access error occurs.ResultSet.next()public void close()
close in interface java.lang.AutoCloseableclose in interface java.sql.ResultSetclose in class VTITemplateResultSet.close()public java.lang.String getString(int columnNumber)
throws java.sql.SQLException
getString in interface java.sql.ResultSetgetString in class VTITemplateBasejava.sql.SQLException - If database-access error occurs.ResultSet.getString(int)public boolean wasNull()
wasNull in interface java.sql.ResultSetwasNull in class VTITemplateBaseResultSet.wasNull()Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.