Other JDBC 3.x configuration
The following sections describe some additional configuration settings for the JDBC 3.x driver.
Network timeout
The amount of time, in milliseconds, the driver will wait for a response when it makes an API call to Athena. After this time, the driver throws a timeout exception.
The network timeout cannot be set as a connection parameter. To set it, call the
setNetworkTimeout
method on a JDBC Connection
object.
This value can be changed during the lifecycle of the JDBC connection. The default
value of this parameter is infinity
.
The following example sets the network timeout to 5000 milliseconds.
... AthenaDriver driver = new AthenaDriver(); Connection connection = driver.connect(url, connectionParameters); connection.setNetworkTimeout(null, 5000); ...
Query timeout
The amount of time, in seconds, the driver will wait for a query to complete on Athena after a query has been submitted. After this time, the driver attempts to cancel the submitted query and throws a timeout exception.
The query timeout cannot be set as a connection parameter. To set it, call the
setQueryTimeout
method on a JDBC Statement
object.
This value can be changed during the lifecycle of a JDBC statement. The default
value of this parameter is 0
(zero). A value of 0
means
that queries can run until they complete (subject to Service Quotas).
The following example sets the query timeout to 5 seconds.
... AthenaDriver driver = new AthenaDriver(); Connection connection = driver.connect(url, connectionParameters); Statement statement = connection.createStatement(); statement.setQueryTimeout(5); ...