Package org.glassfish.api.jdbc
Class SQLTraceRecord
java.lang.Object
org.glassfish.api.jdbc.SQLTraceRecord
- All Implemented Interfaces:
Serializable
Information related to SQL operations executed by the applications are stored in this object.
This trace record is used to log all the sql statements in a particular format.
- Author:
- Shalini M
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplication Name which executed the SQL statementGet the stack frame for the method call in the application that triggered SQL execution, if the call comes from a deployed application.Gets the class name in the application which executed the SQL query, expressed as a String.Gets the method name in the application which executed the SQL query, expressed as a String.Module name of an application which executed the SQL statement.Object[]Gets the parameters of the method that executed the SQL query.Gets the pool name in which the SQL statement is executed.SQL query related to the database operation if applicable.longGets the thread ID from which the SQL statement originated.Gets the thread Name from which the SQL statement originated.longGets the time of execution of query.voidsetApplicationName(String applicationName) Set the application name which executed the SQL statementvoidsetCallingApplicationMethod(StackWalker.StackFrame callingApplicationMethod) Set the stack frame for the method call in the application that triggered SQL execution.voidsetClassName(String className) Set the class name which executed the SQL query.voidsetMethodName(String methodName) Sets the method name that executes the SQL query.voidsetModuleName(String moduleName) Set the module name which executed the SQL statementvoidSets the parameters of the method that executed the SQL query.voidsetPoolName(String poolName) Sets the poolName in which the SQL statement is executed.voidsetSqlQuery(String sqlQuery) Set the SQL query related to the database operationvoidsetThreadID(long threadID) Sets the thread ID from which the SQL statement originated.voidsetThreadName(String threadName) Sets the thread Name from which the SQL statement originated.voidsetTimeStamp(long timeStamp) Sets the time of execution of query.toString()
-
Constructor Details
-
SQLTraceRecord
public SQLTraceRecord()
-
-
Method Details
-
getClassName
Gets the class name in the application which executed the SQL query, expressed as a String. If it's not possible to detect the application, it will be the class name which directly invoked the connection.- Returns:
- The class name of the SQL query expressed as a String.
-
setClassName
Set the class name which executed the SQL query.- Parameters:
className- class name of the SQL query.
-
getMethodName
Gets the method name in the application which executed the SQL query, expressed as a String. If it's not possible to detect the application, it will be the method name which directly invoked the connection.- Returns:
- methodName that executed the SQL query.
-
setMethodName
Sets the method name that executes the SQL query.- Parameters:
methodName- that executes the SQL query.
-
getPoolName
Gets the pool name in which the SQL statement is executed.- Returns:
- poolName in which the SQL statement is executed.
-
setPoolName
Sets the poolName in which the SQL statement is executed.- Parameters:
poolName- in which the SQL statement is executed.
-
getThreadID
public long getThreadID()Gets the thread ID from which the SQL statement originated.- Returns:
- long threadID from which the SQL statement originated.
-
setThreadID
public void setThreadID(long threadID) Sets the thread ID from which the SQL statement originated.- Parameters:
threadID- from which the SQL statement originated.
-
getThreadName
Gets the thread Name from which the SQL statement originated.- Returns:
- String threadName from which the SQL statement originated.
-
setThreadName
Sets the thread Name from which the SQL statement originated.- Parameters:
threadName- from which the SQL statement originated.
-
getTimeStamp
public long getTimeStamp()Gets the time of execution of query.- Returns:
- long timeStamp of execution of query.
-
setTimeStamp
public void setTimeStamp(long timeStamp) Sets the time of execution of query.- Parameters:
timeStamp- of execution of query.
-
getParams
Gets the parameters of the method that executed the SQL query. Includes information like SQL query, arguments and so on.- Returns:
- Object[] params method parameters that execute SQL query.
-
setParams
Sets the parameters of the method that executed the SQL query. Includes information like SQL query, arguments and so on.- Parameters:
params- method parameters that execute SQL query.
-
getSqlQuery
SQL query related to the database operation if applicable.- Returns:
- SQL query
-
setSqlQuery
Set the SQL query related to the database operation- Parameters:
sqlQuery-
-
getApplicationName
Application Name which executed the SQL statement- Returns:
- Application name
-
setApplicationName
Set the application name which executed the SQL statement- Parameters:
applicationName-
-
getModuleName
Module name of an application which executed the SQL statement. If the application doesn't have modules it will be equal to the application name- Returns:
- Module name
-
setModuleName
Set the module name which executed the SQL statement- Parameters:
moduleName-
-
getCallingApplicationMethod
Get the stack frame for the method call in the application that triggered SQL execution, if the call comes from a deployed application. This returns a frame which returns a class from theStackWalker.StackFrame.getDeclaringClass()method (is enabled).invalid reference
StackWalker.Option.RETAIN_CLASS_REFERENCE- Returns:
- Stack frame that represents a call to a server component that triggered SQL execution
-
setCallingApplicationMethod
Set the stack frame for the method call in the application that triggered SQL execution. TheStackWalker.StackFrame.getDeclaringClass()should return a class and never throwUnsupportedOperationException. -
toString
-