Skip to content

Conversation

@wojtha
Copy link
Contributor

@wojtha wojtha commented Apr 25, 2025

This PR fixes #2432

ActiveRecord.connection.verify! fails on Rails 7.1.0+ when reconnection is needed, because Rails 7.1 added an optional argument restore_transactions: false to the #reconnect! method which is used e.g. inside the #verify!

This change has been implemented in rails/rails#44573 and it appeared in Rails 7.1.0beta1 for the first time.

Oracle Enhanced Driver Implementation

def reconnect! # :nodoc:
super
_connection.reset!
rescue OracleEnhanced::ConnectionException => e
@logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}" if @logger
end

Rails 7.1.0beta1 Implementation

https://github.com/rails/rails/blob/2d7bc98897053658ad904b12e5b19a52b8cc3617/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L560-L565

Rails 7.1.5.1 Implementation

https://github.com/rails/rails/blob/14c115b120ed089331ff3dc13f36bd9129ced33d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L680-L712

@ddalcino
Copy link

ddalcino commented Jun 3, 2025

Thank you, this helped me with an issue I was having with #2425

@yahonda
Copy link
Collaborator

yahonda commented Jun 13, 2025

Related to rails/rails#44573

@yahonda yahonda merged commit 9953abe into rsim:master Jun 13, 2025
1 check passed
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Jun 13, 2025
Add optional argument to reconnect for Rails 7.1+ compatibility
yahonda added a commit that referenced this pull request Jun 13, 2025
Merge pull request #2433 from wojtha/fix-rails-71-reconnect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActiveRecord.connection.verify! fails on Rails 7.1.0+ when reconnection is needed

3 participants