Package org.springframework.jdbc.core

# Interface JdbcOperations

All Known Implementing Classes:
  `JdbcTemplate`

public interface JdbcOperations
Interface specifying a basic set of JDBC operations.

Implemented by `JdbcTemplate`. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Alternatively, the standard JDBC infrastructure can be mocked. However, mocking this interface constitutes significantly less work. As an alternative to a mock objects approach to testing data access code, consider the powerful integration testing support provided via the Spring TestContext Framework, in the `spring-test` artifact.

NOTE: As of 6.1, there is a unified JDBC access facade available in the form of `JdbcClient`. `JdbcClient` provides a fluent API style for common JDBC queries/updates with flexible use of indexed or named parameters. It delegates to `JdbcOperations`/`NamedParameterJdbcOperations` for actual execution.

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  - `JdbcTemplate`
  - `NamedParameterJdbcOperations`

## Method Summary

Modifier and Type
Method
Description
`int[]`
`batchUpdate(String... sql)`
Issue multiple SQL updates on a single JDBC Statement using batching.
`<T> int[][]`
`batchUpdate(String sql, Collection<T> batchArgs, int batchSize, ParameterizedPreparedStatementSetter<T> pss)`
Execute multiple batches using the supplied SQL statement with the collect of supplied arguments.
`int[]`
`batchUpdate(String sql, List<Object[]> batchArgs)`
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
`int[]`
`batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes)`
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
`int[]`
`batchUpdate(String sql, BatchPreparedStatementSetter pss)`
Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values.
`int[]`
`batchUpdate(PreparedStatementCreator psc, BatchPreparedStatementSetter pss, KeyHolder generatedKeyHolder)`
Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values.
`Map<String,Object>`
`call(CallableStatementCreator csc, List<SqlParameter> declaredParameters)`
Execute an SQL call using a CallableStatementCreator to provide SQL and any required parameters.
`void`
`execute(String sql)`
Issue a single SQL execute, typically a DDL statement.
`<T> T`
`execute(String callString, CallableStatementCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement.
`<T> T`
`execute(String sql, PreparedStatementCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement.
`<T> T`
`execute(CallableStatementCreator csc, CallableStatementCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement.
`<T> T`
`execute(ConnectionCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC Connection.
`<T> T`
`execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement.
`<T> T`
`execute(StatementCallback<T> action)`
Execute a JDBC data access operation, implemented as callback action working on a JDBC Statement.
`<T> T`
`query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor.
`void`
`query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.
`<T> List<T>`
`query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper.
`<T> T`
`query(String sql, Object[] args, ResultSetExtractor<T> rse)`
Deprecated.
as of 5.3, in favor of `query(String, ResultSetExtractor, Object...)`
`void`
`query(String sql, Object[] args, RowCallbackHandler rch)`
Deprecated.
as of 5.3, in favor of `query(String, RowCallbackHandler, Object...)`
`<T> List<T>`
`query(String sql, Object[] args, RowMapper<T> rowMapper)`
Deprecated.
as of 5.3, in favor of `query(String, RowMapper, Object...)`
`<T> T`
`query(String sql, PreparedStatementSetter pss, ResultSetExtractor<T> rse)`
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
`void`
`query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch)`
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.
`<T> List<T>`
`query(String sql, PreparedStatementSetter pss, RowMapper<T> rowMapper)`
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper.
`<T> T`
`query(String sql, ResultSetExtractor<T> rse)`
Execute a query given static SQL, reading the ResultSet with a ResultSetExtractor.
`<T> T`
`query(String sql, ResultSetExtractor<T> rse, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor.
`void`
`query(String sql, RowCallbackHandler rch)`
Execute a query given static SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler.
`void`
`query(String sql, RowCallbackHandler rch, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.
`<T> List<T>`
`query(String sql, RowMapper<T> rowMapper)`
Execute a query given static SQL, mapping each row to a result object via a RowMapper.
`<T> List<T>`
`query(String sql, RowMapper<T> rowMapper, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper.
`<T> T`
`query(PreparedStatementCreator psc, ResultSetExtractor<T> rse)`
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
`void`
`query(PreparedStatementCreator psc, RowCallbackHandler rch)`
Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler.
`<T> List<T>`
`query(PreparedStatementCreator psc, RowMapper<T> rowMapper)`
Query using a prepared statement, mapping each row to a result object via a RowMapper.
`List<Map<String,Object>>`
`queryForList(String sql)`
Execute a query for a result list, given static SQL.
`<T> List<T>`
`queryForList(String sql, Class<T> elementType)`
Execute a query for a result list, given static SQL.
`<T> List<T>`
`queryForList(String sql, Class<T> elementType, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
`List<Map<String,Object>>`
`queryForList(String sql, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
`List<Map<String,Object>>`
`queryForList(String sql, Object[] args, int[] argTypes)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
`<T> List<T>`
`queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
`<T> List<T>`
`queryForList(String sql, Object[] args, Class<T> elementType)`
Deprecated.
as of 5.3, in favor of `queryForList(String, Class, Object...)`
`Map<String,Object>`
`queryForMap(String sql)`
Execute a query for a result map, given static SQL.
`Map<String,Object>`
`queryForMap(String sql, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map.
`Map<String,Object>`
`queryForMap(String sql, Object[] args, int[] argTypes)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map.
`<T> T`
`queryForObject(String sql, Class<T> requiredType)`
Execute a query for a result object, given static SQL.
`<T> T`
`queryForObject(String sql, Class<T> requiredType, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.
`<T> T`
`queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.
`<T> T`
`queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper.
`<T> T`
`queryForObject(String sql, Object[] args, Class<T> requiredType)`
Deprecated.
as of 5.3, in favor of `queryForObject(String, Class, Object...)`
`<T> T`
`queryForObject(String sql, Object[] args, RowMapper<T> rowMapper)`
Deprecated.
as of 5.3, in favor of `queryForObject(String, RowMapper, Object...)`
`<T> T`
`queryForObject(String sql, RowMapper<T> rowMapper)`
Execute a query given static SQL, mapping a single result row to a result object via a RowMapper.
`<T> T`
`queryForObject(String sql, RowMapper<T> rowMapper, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper.
`SqlRowSet`
`queryForRowSet(String sql)`
Execute a query for an SqlRowSet, given static SQL.
`SqlRowSet`
`queryForRowSet(String sql, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet.
`SqlRowSet`
`queryForRowSet(String sql, Object[] args, int[] argTypes)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet.
`<T> Stream<T>`
`queryForStream(String sql, PreparedStatementSetter pss, RowMapper<T> rowMapper)`
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.
`<T> Stream<T>`
`queryForStream(String sql, RowMapper<T> rowMapper)`
Execute a query given static SQL, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.
`<T> Stream<T>`
`queryForStream(String sql, RowMapper<T> rowMapper, Object... args)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.
`<T> Stream<T>`
`queryForStream(PreparedStatementCreator psc, RowMapper<T> rowMapper)`
Query using a prepared statement, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.
`int`
`update(String sql)`
Issue a single SQL update operation (such as an insert, update or delete statement).
`int`
`update(String sql, Object... args)`
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
`int`
`update(String sql, Object[] args, int[] argTypes)`
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
`int`
`update(String sql, PreparedStatementSetter pss)`
Issue an update statement using a PreparedStatementSetter to set bind parameters, with given SQL.
`int`
`update(PreparedStatementCreator psc)`
Issue a single SQL update operation (such as an insert, update or delete statement) using a PreparedStatementCreator to provide SQL and any required parameters.
`int`
`update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder)`
Issue an update statement using a PreparedStatementCreator to provide SQL and any required parameters.

## Method Details

### execute

@Nullable <T> T execute(ConnectionCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC Connection. This allows for implementing arbitrary data access operations, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `action` - a callback object that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### execute

@Nullable <T> T execute(StatementCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC Statement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `action` - a callback that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### execute

void execute(String sql) throws org.springframework.dao.DataAccessException
Issue a single SQL execute, typically a DDL statement.

Parameters:
  `sql` - static SQL to execute
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### query

@Nullable <T> T query(String sql, ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
Execute a query given static SQL, reading the ResultSet with a ResultSetExtractor.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `query` method with `null` as argument array.

Parameters:
  `sql` - the SQL query to execute
  `rse` - a callback that will extract all rows of results
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `query(String, ResultSetExtractor, Object...)`

### query

void query(String sql, RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
Execute a query given static SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `query` method with `null` as argument array.

Parameters:
  `sql` - the SQL query to execute
  `rch` - a callback that will extract results, one row at a time
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `query(String, RowCallbackHandler, Object...)`

### query

<T> List<T> query(String sql, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Execute a query given static SQL, mapping each row to a result object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `query` method with `null` as argument array.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `query(String, RowMapper, Object...)`

### queryForStream

<T> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Execute a query given static SQL, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `query` method with `null` as argument array.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
Returns:
  the result Stream, containing mapped objects, needing to be closed once fully processed (for example, through a try-with-resources clause)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
Since:
  5.3
See Also:
  - `queryForStream(String, RowMapper, Object...)`

### queryForObject

@Nullable <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Execute a query given static SQL, mapping a single result row to a result object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForObject(String, RowMapper, Object...)` method with `null` as argument array.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
Returns:
  the single mapped object (may be `null` if the given `RowMapper` returned null)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForObject(String, RowMapper, Object...)`

### queryForObject

@Nullable <T> T queryForObject(String sql, Class<T> requiredType) throws org.springframework.dao.DataAccessException
Execute a query for a result object, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForObject(String, Class, Object...)` method with `null` as argument array.

This method is useful for running static SQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.

Parameters:
  `sql` - the SQL query to execute
  `requiredType` - the type that the result object is expected to match
Returns:
  the result object of the required type, or `null` in case of SQL NULL
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `IncorrectResultSetColumnCountException` - if the query does not return a row containing a single column
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForObject(String, Class, Object...)`

### queryForMap

Map<String,Object> queryForMap(String sql) throws org.springframework.dao.DataAccessException
Execute a query for a result map, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForMap(String, Object...)` method with `null` as argument array.

The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).

Parameters:
  `sql` - the SQL query to execute
Returns:
  the result Map (one entry per column, with column name as key)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForMap(String, Object...)`
  - `ColumnMapRowMapper`

### queryForList

<T> List<T> queryForList(String sql, Class<T> elementType) throws org.springframework.dao.DataAccessException
Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForList` method with `null` as argument array.

The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.

Parameters:
  `sql` - the SQL query to execute
  `elementType` - the required type of element in the result list (for example, `Integer.class`)
Returns:
  a List of objects that match the specified element type
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForList(String, Class, Object...)`
  - `SingleColumnRowMapper`

### queryForList

List<Map<String,Object>> queryForList(String sql) throws org.springframework.dao.DataAccessException
Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForList` method with `null` as argument array.

The results will be mapped to a List (one entry for each row) of Maps (one entry for each column using the column name as the key). Each element in the list will be of the form returned by this interface's `queryForMap` methods.

Parameters:
  `sql` - the SQL query to execute
Returns:
  a List that contains a Map per row
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForList(String, Object...)`

### queryForRowSet

SqlRowSet queryForRowSet(String sql) throws org.springframework.dao.DataAccessException
Execute a query for an SqlRowSet, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded `queryForRowSet` method with `null` as argument array.

The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.

Note that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, a standard JDBC `CachedRowSet` is used.

Parameters:
  `sql` - the SQL query to execute
Returns:
  an SqlRowSet representation (possibly a wrapper around a `javax.sql.rowset.CachedRowSet`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForRowSet(String, Object...)`
  - `SqlRowSetResultSetExtractor`
  - `CachedRowSet`

### update

int update(String sql) throws org.springframework.dao.DataAccessException
Issue a single SQL update operation (such as an insert, update or delete statement).

Parameters:
  `sql` - static SQL to execute
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem.

### batchUpdate

int[] batchUpdate(String... sql) throws org.springframework.dao.DataAccessException
Issue multiple SQL updates on a single JDBC Statement using batching.

Will fall back to separate updates on a single Statement if the JDBC driver does not support batch updates.

Parameters:
  `sql` - defining an array of SQL statements that will be executed.
Returns:
  an array of the number of rows affected by each statement
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the batch

### execute

@Nullable <T> T execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `action` - a callback that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### execute

@Nullable <T> T execute(String sql, PreparedStatementCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `sql` - the SQL to execute
  `action` - a callback that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### query

@Nullable <T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `rse` - a callback that will extract results
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem
See Also:
  - `PreparedStatementCreatorFactory`

### query

@Nullable <T> T query(String sql, @Nullable PreparedStatementSetter pss, ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.

Parameters:
  `sql` - the SQL query to execute
  `pss` - a callback that knows how to set values on the prepared statement. If this is `null`, the SQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this callback may be used to set the fetch size and other performance options.
  `rse` - a callback that will extract results
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### query

@Nullable <T> T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `rse` - a callback that will extract results
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `Types`

### query

@Deprecated @Nullable <T> T query(String sql, @Nullable Object[] args, ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `query(String, ResultSetExtractor, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `rse` - a callback that will extract results
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails

### query

@Nullable <T> T query(String sql, ResultSetExtractor<T> rse, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor.

Parameters:
  `sql` - the SQL query to execute
  `rse` - a callback that will extract results
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  an arbitrary result object, as returned by the ResultSetExtractor
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1

### query

void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `rch` - a callback that will extract results, one row at a time
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem
See Also:
  - `PreparedStatementCreatorFactory`

### query

void query(String sql, @Nullable PreparedStatementSetter pss, RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Parameters:
  `sql` - the SQL query to execute
  `pss` - a callback that knows how to set values on the prepared statement. If this is `null`, the SQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this callback may be used to set the fetch size and other performance options.
  `rch` - a callback that will extract results, one row at a time
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails

### query

void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `rch` - a callback that will extract results, one row at a time
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `Types`

### query

@Deprecated void query(String sql, @Nullable Object[] args, RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `query(String, RowCallbackHandler, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `rch` - a callback that will extract results, one row at a time
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails

### query

void query(String sql, RowCallbackHandler rch, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Parameters:
  `sql` - the SQL query to execute
  `rch` - a callback that will extract results, one row at a time
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1

### query

<T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query using a prepared statement, mapping each row to a result object via a RowMapper.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `rowMapper` - a callback that will map one object per row
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem
See Also:
  - `PreparedStatementCreatorFactory`

### query

<T> List<T> query(String sql, @Nullable PreparedStatementSetter pss, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `pss` - a callback that knows how to set values on the prepared statement. If this is `null`, the SQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this callback may be used to set the fetch size and other performance options.
  `rowMapper` - a callback that will map one object per row
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails

### query

<T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `rowMapper` - a callback that will map one object per row
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `Types`

### query

@Deprecated <T> List<T> query(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `query(String, RowMapper, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `rowMapper` - a callback that will map one object per row
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails

### query

<T> List<T> query(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the result List, containing mapped objects
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1

### queryForStream

<T> Stream<T> queryForStream(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query using a prepared statement, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `rowMapper` - a callback that will map one object per row
Returns:
  the result Stream, containing mapped objects, needing to be closed once fully processed (for example, through a try-with-resources clause)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem
Since:
  5.3
See Also:
  - `PreparedStatementCreatorFactory`

### queryForStream

<T> Stream<T> queryForStream(String sql, @Nullable PreparedStatementSetter pss, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.

Parameters:
  `sql` - the SQL query to execute
  `pss` - a callback that knows how to set values on the prepared statement. If this is `null`, the SQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this callback may be used to set the fetch size and other performance options.
  `rowMapper` - a callback that will map one object per row
Returns:
  the result Stream, containing mapped objects, needing to be closed once fully processed (for example, through a try-with-resources clause)
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  5.3

### queryForStream

<T> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the result Stream, containing mapped objects, needing to be closed once fully processed (for example, through a try-with-resources clause)
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  5.3

### queryForObject

@Nullable <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type)
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `rowMapper` - a callback that will map one object per row
Returns:
  the single mapped object (may be `null` if the given `RowMapper` returned null)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if the query fails

### queryForObject

@Deprecated @Nullable <T> T queryForObject(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `queryForObject(String, RowMapper, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `rowMapper` - a callback that will map one object per row
Returns:
  the single mapped object (may be `null` if the given `RowMapper` returned null)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if the query fails

### queryForObject

@Nullable <T> T queryForObject(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper.

Parameters:
  `sql` - the SQL query to execute
  `rowMapper` - a callback that will map one object per row
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the single mapped object (may be `null` if the given `RowMapper` returned null)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1

### queryForObject

@Nullable <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.

The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `requiredType` - the type that the result object is expected to match
Returns:
  the result object of the required type, or `null` in case of SQL NULL
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `IncorrectResultSetColumnCountException` - if the query does not return a row containing a single column
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForObject(String, Class)`
  - `Types`

### queryForObject

@Deprecated @Nullable <T> T queryForObject(String sql, @Nullable Object[] args, Class<T> requiredType) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `queryForObject(String, Class, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.

The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `requiredType` - the type that the result object is expected to match
Returns:
  the result object of the required type, or `null` in case of SQL NULL
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `IncorrectResultSetColumnCountException` - if the query does not return a row containing a single column
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForObject(String, Class)`

### queryForObject

@Nullable <T> T queryForObject(String sql, Class<T> requiredType, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.

The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.

Parameters:
  `sql` - the SQL query to execute
  `requiredType` - the type that the result object is expected to match
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the result object of the required type, or `null` in case of SQL NULL
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `IncorrectResultSetColumnCountException` - if the query does not return a row containing a single column
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1
See Also:
  - `queryForObject(String, Class)`

### queryForMap

Map<String,Object> queryForMap(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map.

The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
Returns:
  the result Map (one entry per column, with column name as key)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForMap(String)`
  - `ColumnMapRowMapper`
  - `Types`

### queryForMap

Map<String,Object> queryForMap(String sql, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map.

The `queryForMap` methods defined by this interface are appropriate when you don't have a domain model. Otherwise, consider using one of the `queryForObject` methods.

The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the result Map (one entry for each column, using the column name as the key)
Throws:
  `org.springframework.dao.IncorrectResultSizeDataAccessException` - if the query does not return exactly one row
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForMap(String)`
  - `ColumnMapRowMapper`

### queryForList

<T> List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.

The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
  `elementType` - the required type of element in the result list (for example, `Integer.class`)
Returns:
  a List of objects that match the specified element type
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForList(String, Class)`
  - `SingleColumnRowMapper`

### queryForList

@Deprecated <T> List<T> queryForList(String sql, @Nullable Object[] args, Class<T> elementType) throws org.springframework.dao.DataAccessException
Deprecated.
as of 5.3, in favor of `queryForList(String, Class, Object...)`
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.

The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
  `elementType` - the required type of element in the result list (for example, `Integer.class`)
Returns:
  a List of objects that match the specified element type
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForList(String, Class)`
  - `SingleColumnRowMapper`

### queryForList

<T> List<T> queryForList(String sql, Class<T> elementType, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.

The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.

Parameters:
  `sql` - the SQL query to execute
  `elementType` - the required type of element in the result list (for example, `Integer.class`)
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  a List of objects that match the specified element type
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
Since:
  3.0.1
See Also:
  - `queryForList(String, Class)`
  - `SingleColumnRowMapper`

### queryForList

List<Map<String,Object>> queryForList(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.

The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the list will be of the form returned by this interface's `queryForMap` methods.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
Returns:
  a List that contains a Map per row
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForList(String)`
  - `Types`

### queryForList

List<Map<String,Object>> queryForList(String sql, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.

The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the list will be of the form returned by this interface's `queryForMap` methods.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  a List that contains a Map per row
Throws:
  `org.springframework.dao.DataAccessException` - if the query fails
See Also:
  - `queryForList(String)`

### queryForRowSet

SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet.

The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.

Note that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, a standard JDBC `CachedRowSet` is used.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
Returns:
  an SqlRowSet representation (possibly a wrapper around a `javax.sql.rowset.CachedRowSet`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForRowSet(String)`
  - `SqlRowSetResultSetExtractor`
  - `CachedRowSet`
  - `Types`

### queryForRowSet

SqlRowSet queryForRowSet(String sql, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet.

The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.

Note that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, a standard JDBC `CachedRowSet` is used.

Parameters:
  `sql` - the SQL query to execute
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  an SqlRowSet representation (possibly a wrapper around a `javax.sql.rowset.CachedRowSet`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem executing the query
See Also:
  - `queryForRowSet(String)`
  - `SqlRowSetResultSetExtractor`
  - `CachedRowSet`

### update

int update(PreparedStatementCreator psc) throws org.springframework.dao.DataAccessException
Issue a single SQL update operation (such as an insert, update or delete statement) using a PreparedStatementCreator to provide SQL and any required parameters.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.

Parameters:
  `psc` - a callback that provides SQL and any necessary parameters
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update
See Also:
  - `PreparedStatementCreatorFactory`

### update

int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder) throws org.springframework.dao.DataAccessException
Issue an update statement using a PreparedStatementCreator to provide SQL and any required parameters. Generated keys will be put into the given KeyHolder.

Note that the given PreparedStatementCreator has to create a statement with activated extraction of generated keys (a JDBC 3.0 feature). This can either be done directly or through using a PreparedStatementCreatorFactory.

This method requires support for generated keys in the JDBC driver.

Parameters:
  `psc` - a callback that provides SQL and any necessary parameters
  `generatedKeyHolder` - a KeyHolder that will hold the generated keys
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update
See Also:
  - `PreparedStatementCreatorFactory`
  - `GeneratedKeyHolder`
  - `DatabaseMetaData.supportsGetGeneratedKeys()`

### update

int update(String sql, @Nullable PreparedStatementSetter pss) throws org.springframework.dao.DataAccessException
Issue an update statement using a PreparedStatementSetter to set bind parameters, with given SQL. Simpler than using a PreparedStatementCreator as this method will create the PreparedStatement: The PreparedStatementSetter just needs to set parameters.

Parameters:
  `sql` - the SQL containing bind parameters
  `pss` - helper that sets bind parameters. If this is `null` we run an update with static SQL.
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update

### update

int update(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

Parameters:
  `sql` - the SQL containing bind parameters
  `args` - arguments to bind to the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update
See Also:
  - `Types`

### update

int update(String sql, @Nullable Object... args) throws org.springframework.dao.DataAccessException
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

Parameters:
  `sql` - the SQL containing bind parameters
  `args` - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain `SqlParameterValue` objects which indicate not only the argument value but also the SQL type and optionally the scale
Returns:
  the number of rows affected
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update

### batchUpdate

int[] batchUpdate(String sql, BatchPreparedStatementSetter pss) throws org.springframework.dao.DataAccessException
Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values.

Will fall back to separate updates on a single PreparedStatement if the JDBC driver does not support batch updates.

Parameters:
  `sql` - defining PreparedStatement that will be reused. All statements in the batch will use the same SQL.
  `pss` - object to set parameters on the PreparedStatement created by this method
Returns:
  an array of the number of rows affected by each statement (may also contain special JDBC-defined negative values for affected rows such as `Statement.SUCCESS_NO_INFO`/`Statement.EXECUTE_FAILED`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update

### batchUpdate

int[] batchUpdate(PreparedStatementCreator psc, BatchPreparedStatementSetter pss, KeyHolder generatedKeyHolder) throws org.springframework.dao.DataAccessException
Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values. Generated keys will be put into the given KeyHolder.

Note that the given PreparedStatementCreator has to create a statement with activated extraction of generated keys (a JDBC 3.0 feature). This can either be done directly or through using a PreparedStatementCreatorFactory.

This method requires support for generated keys in the JDBC driver. It will fall back to separate updates on a single PreparedStatement if the JDBC driver does not support batch updates.

Parameters:
  `psc` - a callback that creates a PreparedStatement given a Connection
  `pss` - object to set parameters on the PreparedStatement created by this method
  `generatedKeyHolder` - a KeyHolder that will hold the generated keys
Returns:
  an array of the number of rows affected by each statement (may also contain special JDBC-defined negative values for affected rows such as `Statement.SUCCESS_NO_INFO`/`Statement.EXECUTE_FAILED`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update
Since:
  6.1
See Also:
  - `GeneratedKeyHolder`
  - `DatabaseMetaData.supportsGetGeneratedKeys()`

### batchUpdate

int[] batchUpdate(String sql, List<Object[]> batchArgs) throws org.springframework.dao.DataAccessException
Execute a batch using the supplied SQL statement with the batch of supplied arguments.

Parameters:
  `sql` - the SQL statement to execute
  `batchArgs` - the List of Object arrays containing the batch of arguments for the query
Returns:
  an array containing the numbers of rows affected by each update in the batch (may also contain special JDBC-defined negative values for affected rows such as `Statement.SUCCESS_NO_INFO`/`Statement.EXECUTE_FAILED`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update

### batchUpdate

int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes) throws org.springframework.dao.DataAccessException
Execute a batch using the supplied SQL statement with the batch of supplied arguments.

Parameters:
  `sql` - the SQL statement to execute.
  `batchArgs` - the List of Object arrays containing the batch of arguments for the query
  `argTypes` - the SQL types of the arguments (constants from `java.sql.Types`)
Returns:
  an array containing the numbers of rows affected by each update in the batch (may also contain special JDBC-defined negative values for affected rows such as `Statement.SUCCESS_NO_INFO`/`Statement.EXECUTE_FAILED`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update

### batchUpdate

<T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize, ParameterizedPreparedStatementSetter<T> pss) throws org.springframework.dao.DataAccessException
Execute multiple batches using the supplied SQL statement with the collect of supplied arguments. The arguments' values will be set using the ParameterizedPreparedStatementSetter. Each batch should be of size indicated in 'batchSize'.

Parameters:
  `sql` - the SQL statement to execute.
  `batchArgs` - the List of Object arrays containing the batch of arguments for the query
  `batchSize` - batch size
  `pss` - the ParameterizedPreparedStatementSetter to use
Returns:
  an array containing for each batch another array containing the numbers of rows affected by each update in the batch (may also contain special JDBC-defined negative values for affected rows such as `Statement.SUCCESS_NO_INFO`/`Statement.EXECUTE_FAILED`)
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update
Since:
  3.1

### execute

@Nullable <T> T execute(CallableStatementCreator csc, CallableStatementCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `csc` - a callback that creates a CallableStatement given a Connection
  `action` - a callback that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### execute

@Nullable <T> T execute(String callString, CallableStatementCallback<T> action) throws org.springframework.dao.DataAccessException
Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

The callback action can return a result object, for example a domain object or a collection of domain objects.

Parameters:
  `callString` - the SQL call string to execute
  `action` - a callback that specifies the action
Returns:
  a result object returned by the action, or `null` if none
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem

### call

Map<String,Object> call(CallableStatementCreator csc, List<SqlParameter> declaredParameters) throws org.springframework.dao.DataAccessException
Execute an SQL call using a CallableStatementCreator to provide SQL and any required parameters.

Parameters:
  `csc` - a callback that provides SQL and any necessary parameters
  `declaredParameters` - list of declared SqlParameter objects
Returns:
  a Map of extracted out parameters
Throws:
  `org.springframework.dao.DataAccessException` - if there is any problem issuing the update