Setting timeouts for queries and the maximum number of rows in query results

You can set a timeout for SQL statements and set a maximum number of rows for pureQuery to return in query results.

About this task

You can set values for these properties globally for all SQL data manipulation language (DML) statements that your pureQuery application runs, or locally for all SQL DML statements that the application uses with an instance of an implementation of the Data interface. You cannot set them locally for individual statements.

pureQuery passes the values for these properties to corresponding JDBC Statement methods.

queryTimeoutInSeconds
The number of seconds to wait for the SQL DML statement to run. If the statement does not complete within the specified time, pureQuery throws a runtime exception that is caused by an SQLException. A value of 0 allows statements to run indefinitely.
maxResultsRow
The maximum number of rows that a statement returns in query results. The rows are discarded after the count of rows reaches this limit. A value of 0 allows query results to contain an indefinite number of rows.
If you want to configure this maximum number of rows for individual statements, rather than for all statements in your application that return query results, you have two choices:
  • Use the FETCH FIRST n ROWS clause in your statements, or the equivalent syntax that your target database supports.
  • Use a ResultHandler that processes a limited number of rows. For example, you might use an IteratorPagingResultHandler.

Procedure

To set values for these properties, follow either of these two steps. pureQuery searches for values in the order in which the two methods appear.


Feedback