Class TimeoutDriver

All Implemented Interfaces:
Driver

@DriverCapability(prefix="timeout", description="Enforces query timeout limits on all statements", capabilities="resilience") @DriverParameter(name="queryTimeout",type=INTEGER,description="Query timeout in seconds (0 = no timeout)",defaultValue="30",min=0L) @DriverParameter(name="cancelOnTimeout",type=BOOLEAN,description="Whether to attempt cancellation on timeout",defaultValue="true") public class TimeoutDriver extends AbstractProxyDriver
TimeoutDriver enforces query timeout limits on all statements.

This driver wraps statements and applies a configurable query timeout using JDBC's Statement.setQueryTimeout() method. When a query exceeds the timeout, the database driver throws a SQLException.

URL format: jdbc:timeout[param=value,...]:jdbc:target:...

Example URLs:

 jdbc:timeout:jdbc:postgresql://localhost/mydb
 jdbc:timeout[queryTimeout=60]:jdbc:postgresql://localhost/mydb
 jdbc:timeout[queryTimeout=10,cancelOnTimeout=false]:jdbc:mysql://localhost/db
 

Notes:

  • Timeout of 0 means no timeout (unlimited)
  • The actual timeout behavior depends on the underlying JDBC driver
  • Some databases may not support query cancellation