Package org.apache.jmeter.protocol.jdbc

# Class AbstractJDBCTestElement

java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Searchable`, `org.apache.jmeter.testelement.TestElement`

Direct Known Subclasses:
  `AbstractJDBCProcessor`, `JDBCSampler`

public abstract class AbstractJDBCTestElement extends AbstractTestElement
A base class for all JDBC test elements handling the basics of a SQL request.

See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement

`org.apache.jmeter.testelement.TestElement.Companion`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final String`
`ENCODING`

### Fields inherited from interface org.apache.jmeter.testelement.TestElement

`COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractJDBCTestElement()`
Creates a JDBCSampler.

## Method Summary

Modifier and Type
Method
Description
`static void`
`close(Connection c)`
`static void`
`close(ResultSet rs)`
`static void`
`close(Statement s)`
`protected byte[]`
`execute(Connection conn)`
Execute the test element.
`protected byte[]`
`execute(Connection conn, SampleResult sample)`
Execute the test element.
`String`
`getDataSource()`
`int`
`getIntegerQueryTimeout()`
`int`
`getIntegerResultSetMaxRows()`
`String`
`getQuery()`
`String`
`getQueryArguments()`
`String`
`getQueryArgumentsTypes()`
`String`
`getQueryTimeout()`
`String`
`getQueryType()`
`String`
`getResultSetHandler()`
`String`
`getResultSetMaxRows()`
`String`
`getResultVariable()`
`String`
`getVariableNames()`
`void`
`setDataSource(String dataSource)`
`void`
`setQuery(String query)`
`void`
`setQueryArguments(String queryArguments)`
`void`
`setQueryArgumentsTypes(String queryArgumentsType)`
`void`
`setQueryTimeout(String queryTimeout)`
`void`
`setQueryType(String queryType)`
`void`
`setResultSetHandler(String resultSetHandler)`
`void`
`setResultSetMaxRows(String resultSetMaxRows)`
`void`
`setResultVariable(String resultVariable)`
`void`
`setVariableNames(String variableNames)`
`String`
`toString()`

### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

`addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.jmeter.testelement.TestElement

`get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getProps, getSchema, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set`

## Field Details

### ENCODING

protected static final String ENCODING

## Constructor Details

### AbstractJDBCTestElement

protected AbstractJDBCTestElement()
Creates a JDBCSampler.

## Method Details

### execute

protected byte[] execute(Connection conn) throws SQLException, IOException, UnsupportedOperationException
Execute the test element.

Parameters:
  `conn` - a `Connection`
Returns:
  the result of the execute command
Throws:
  `SQLException` - if a database error occurs
  `IOException` - when I/O error occurs
  `UnsupportedOperationException` - if the user provided incorrect query type

### execute

protected byte[] execute(Connection conn, SampleResult sample) throws SQLException, IOException, UnsupportedOperationException
Execute the test element. Use the sample given as argument to set time to first byte in the "latency" field of the SampleResult.

Parameters:
  `conn` - a `Connection`
  `sample` - a `SampleResult` to save the latency
Returns:
  the result of the execute command
Throws:
  `SQLException` - if a database error occurs
  `IOException` - when I/O error occurs
  `UnsupportedOperationException` - if the user provided incorrect query type

### close

public static void close(Connection c)

### close

public static void close(Statement s)

### close

public static void close(ResultSet rs)

### getIntegerQueryTimeout

public int getIntegerQueryTimeout()

Returns:
  the integer representation queryTimeout

### getQueryTimeout

public String getQueryTimeout()

Returns:
  the queryTimeout

### setQueryTimeout

public void setQueryTimeout(String queryTimeout)

Parameters:
  `queryTimeout` - query timeout in seconds

### getIntegerResultSetMaxRows

public int getIntegerResultSetMaxRows()

Returns:
  the integer representation resultSetMaxRows

### getResultSetMaxRows

public String getResultSetMaxRows()

Returns:
  the resultSetMaxRows

### setResultSetMaxRows

public void setResultSetMaxRows(String resultSetMaxRows)

Parameters:
  `resultSetMaxRows` - max number of rows to iterate through the ResultSet

### getQuery

public String getQuery()

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### setQuery

public void setQuery(String query)

Parameters:
  `query` - The query to set.

### getDataSource

public String getDataSource()

Returns:
  Returns the dataSource.

### setDataSource

public void setDataSource(String dataSource)

Parameters:
  `dataSource` - The dataSource to set.

### getQueryType

public String getQueryType()

Returns:
  Returns the queryType.

### setQueryType

public void setQueryType(String queryType)

Parameters:
  `queryType` - The queryType to set.

### getQueryArguments

public String getQueryArguments()

### setQueryArguments

public void setQueryArguments(String queryArguments)

### getQueryArgumentsTypes

public String getQueryArgumentsTypes()

### setQueryArgumentsTypes

public void setQueryArgumentsTypes(String queryArgumentsType)

### getVariableNames

public String getVariableNames()

Returns:
  the variableNames

### setVariableNames

public void setVariableNames(String variableNames)

Parameters:
  `variableNames` - the variableNames to set

### getResultSetHandler

public String getResultSetHandler()

Returns:
  the resultSetHandler

### setResultSetHandler

public void setResultSetHandler(String resultSetHandler)

Parameters:
  `resultSetHandler` - the resultSetHandler to set

### getResultVariable

public String getResultVariable()

Returns:
  the resultVariable

### setResultVariable

public void setResultVariable(String resultVariable)

Parameters:
  `resultVariable` - the variable name in which results will be stored