Class | OCI8AutoRecover
In: | lib/active_record/connection_adapters/oracle_adapter.rb
Parent: | DelegateClass(OCI8)

The OCI8AutoRecover class enhances the OCI8 driver with auto-recover and reset functionality. If a call to exec fails, and autocommit is turned on (ie., we‘re not in the middle of a longer transaction), it will automatically reconnect and try again. If autocommit is turned off, this would be dangerous (as the earlier part of the implied transaction may have failed silently if the connection died) — so instead the connection is marked as dead, to be reconnected on it‘s next use.

### Methods

exec new ping reset!

### Constants

LOST_CONNECTION_ERROR_CODES | = | [ 28, 1012, 3113, 3114 ] |  | ORA-00028: your session has been killed ORA-01012: not logged on ORA-03113: end-of-file on communication channel ORA-03114: not connected to ORACLE

### External Aliases

active | -> | active?
auto_retry | -> | auto_retry?

### Attributes

active | [RW] |

### Public Class methods

new(config, factory = OracleConnectionFactory.new)

### Public Instance methods

exec(sql, *bindvars, &block)

Adds auto-recovery functionality.

See: www.jiubao.org/ruby-oci8/api.en.html#label-11

ping()

Checks connection, returns true if active. Note that ping actively checks the connection, while active? simply returns the last known state.

reset!()

Resets connection, by logging off and creating a new connection.

[Validate]