Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError: wrong number of arguments (given 4, expected 1..3) for activerecord-jdbcsqlite3-adapter #1136

Open
AlexWayfer opened this issue Aug 24, 2023 · 4 comments

Comments

@AlexWayfer
Copy link

I saw similar issues, but sqlite3 adapter seems to not be updated for years.

JRuby 9.4.3.0, ActiveRecord 7.0.7, activerecord-jdbcsqlite3-adapter 70.1.

ArgumentError: wrong number of arguments (given 4, expected 1..3)
                      initialize at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-70.1-java/lib/arjdbc/abstract/core.rb:12
                             new at org/jruby/RubyClass.java:931
                             new at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-70.1-java/lib/arjdbc/jdbc/callbacks.rb:14
                 jdbc_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-70.1-java/lib/arjdbc/jdbc/connection_methods.rb:10
                     public_send at org/jruby/RubyKernel.java:2119
                  new_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:656
         checkout_new_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:700
  try_to_checkout_new_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:679
              acquire_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:640
                        checkout at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:341
                      connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:181
             retrieve_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:211
             retrieve_connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_handling.rb:313
                      connection at /home/alex/.rbenv/versions/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.0.7.2/lib/active_record/connection_handling.rb:280
                          <main> at /home/alex/Projects/ruby/email_address/test/activerecord/user.rb:34
@sampadha
Copy link

Facing similar issue for mysql adapter :
When can we expect activerecord-jdbcmysql-adapter to support rails 7.1?

JRuby 9.4.5.0, ActiveRecord 7.1.0, activerecord-jdbcmysql-adapter 70.1.

Uncaught exception: wrong number of arguments (given 4, expected 1..3)

/home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-70.1-java/lib/arjdbc/abstract/core.rb:13:in `initialize'
/home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/userstamper-4.1.0/lib/userstamper/stampable.rb:22:in columns' /home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/activerecord-7.1.1/lib/active_record/model_schema.rb:503:in column_names'
/home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/userstamper-4.1.0/lib/userstamper/utilities.rb:30:in available_association_columns' /home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/userstamper-4.1.0/lib/userstamper/stampable.rb:69:in add_userstamp_associations'
/home/sam/Projects/SDKs/jruby-9.4.3.0/lib/ruby/gems/shared/gems/userstamper-4.1.0/lib/userstamper/stampable.rb:39:in stampable' /home/sam/Projects/awetest/app/models/regression_test/job.rb:14:in class:Job'
/home/sam/Projects/awetest/app/models/regression_test/job.rb:3:in

@keithrbennett
Copy link

keithrbennett commented Aug 25, 2024

A year later, I have the opposite problem. I get this error:

23:40:20 web.1  | ArgumentError (wrong number of arguments (given 1, expected 4)):
23:40:20 web.1  |
23:40:20 web.1  | activerecord-jdbc-adapter-70.2 (java) lib/arjdbc/sqlite3/adapter.rb:92:in `initialize'
23:40:20 web.1  | activerecord-jdbc-adapter-70.2 (java) lib/arjdbc/abstract/statement_cache.rb:23:in `initialize'
23:40:20 web.1  | org/jruby/RubyClass.java:922:in `new'
23:40:20 web.1  | activerecord (7.2.1) lib/active_record/database_configurations/database_config.rb:26:in `new_connection'

My Gemfile contains:

IS_JRUBY = (defined? JRUBY_VERSION)
if IS_JRUBY
  ruby '3.1.4'
  gem 'activerecord-jdbc-adapter'
  gem 'jdbc-sqlite3'
else
  ruby "3.3.4"
  gem 'sqlite3', '>= 2.0.4', '~> 2.0'
end

My Gemfile.lock contains:

activerecord (7.2.1)
activerecord-jdbc-adapter (70.2-java)
jdbc-sqlite3 (3.42.0.0)

UPDATE: I have reverted to using Postgres so I no longer need an answer, but I will leave this here for informational purposes.

@enebo
Copy link
Member

enebo commented Aug 28, 2024

@keithrbennett your problem is mostly due to the fact we do not support Rails 7.2. The thing we are not communicating well is that 70.x is Rails 7.0.x and when we support Rails 7.2 you will see a version 72.x come out for the adapters. It is good that postgresql is working but that is somewhat surprising since we have a lot of fixes coming in for 7.1 support. It is possible Rails 7.2 reverted something significant and the 70.x gems happen to work?

@keithrbennett
Copy link

@enebo Thanks for your reply. Sorry I didn't explain that clearly. It's not that Postgres works with Rails 7.2, it's just that I only tried to get it to work with Sqlite. This is a web site running on C Ruby in production, but I was hoping to make it JRuby compatible. I will defer that with Postgres until a future time.

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

No branches or pull requests

4 participants