Setting Query Timeout in Microseconds

In addition to the standard JDBC Statement#setQueryTimeout() method which allows you to specify a query timeout in whole seconds, NuoDB also provides a setQueryTimeoutMicros() method in the implementation class, RemStatement. The setQueryTimeoutMicros() method allows you to specify the number of microseconds for the timeout. The parameter is of type long. There is also an RemStatement#getQueryTimeoutMicros() which returns the timeout value as a long value which is the number of microseconds. To use RemStatement#setQueryTimeoutMicros(), you must cast a Statement object to an RemStatement object as in the following code snippet. Here we are setting the query timeout to 500,000 microseconds or 1/2 second.


Caution: Casting from Statement to RemStatement should be done with extreme caution as the underlying RemStatement implementation class is subject to change.