What are the Rails's ActiveRecord database gem

2019-08-28 04:49发布

问题:

When running rails on JRUBY, database adapters have two different gems.

  1. Sql Server: sqlserver gem Vs activerecord-sqlserver-adapter gem
  2. Mysql: jdbcmysql gem vs activerecord-jdbcmysql-adapter gem
  3. Sqlite3: jdbcsqlite3 gem Vs activerecord-jdbcsqlite3-adapter gem
  4. Postgresql: jdbcpostgresql gem Vs activerecord-jdbcpostgresql-adapter gem
  5. jdbc: jdbc gem vs activerecord-jdbc-adapter gem

So question is, What is the difference between jdbcpostgresql and its long form activerecord-jdbcpostgresql-adapter gem?

回答1:

jdbcpostgresql = Java postgresql database

activerecord-jdbcpostgresql-adapter = a postgresql database adapter for Rails ActiveRecord to allow it to be used with JRuby.

JDBC (Java Database Connectivity)

ActiveRecord-JDBC-Adapter (AR-JDBC) is a database adapter for Rails' ActiveRecord component that can be used with JRuby. It allows use of virtually any JDBC-compliant database with your JRuby on Rails application.



回答2:

i don't know the difference but i use the following in rails 3+ apps with jruby and postgres for the Gemfile

gem 'activerecord-jdbcpostgresql-adapter'
gem 'jruby-openssl'

see also the README file - https://github.com/jruby/activerecord-jdbc-adapter