Skip to content

Commit 5d26a8b

Browse files
committed
Add ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter#reconnect
So far `@raw_connection` does not have `close` method and no `connect` method defined, use `@raw_connection.reset` instead.
1 parent edccc3c commit 5d26a8b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def active?
8787
@raw_connection.active?
8888
end
8989

90+
def reset
91+
@raw_connection.reset
92+
end
93+
9094
def reset!
9195
@raw_connection.reset!
9296
rescue OCIException => e
@@ -405,6 +409,11 @@ def ping # :nodoc:
405409
raise
406410
end
407411

412+
def reset
413+
# tentative
414+
reset!
415+
end
416+
408417
# Resets connection, by logging off and creating a new connection.
409418
def reset! # :nodoc:
410419
logoff rescue nil

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ def active? # :nodoc:
451451
false
452452
end
453453

454+
def reconnect
455+
@raw_connection.reset # tentative
456+
rescue OracleEnhanced::ConnectionException
457+
connect
458+
end
459+
454460
# Reconnects to the database.
455461
def reconnect! # :nodoc:
456462
super

0 commit comments

Comments
 (0)