Skip to content Skip to sidebar Skip to footer

Gem Load Error Is: Undefined Method `type_cast_from_database' For Class `arjdbc::mssql::uuidtype'

I'm struggling for many hours now using activerecord-jdbcmssql-adapter with Rails 5.1 (or 5.2). I've installed ant to be able to compile the gem during the bundling. The bundle pro

Solution 1:

I tried it with older rails version: 4.2.10. Here is my gemfile below. After that i can run rails s, rails c and connect to my mssql db. Note this is just the from the rails new app_name command.

source 'https://rubygems.org'
git_source(:github) { |repo|"https://github.com/#{repo}.git" }



# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.10'# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3', '>= 1.3.20'
gem 'activerecord-jdbcmssql-adapter', '~> 1.3', '>= 1.3.20'# Use Puma as the app server
gem 'puma', '~> 3.11'# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'# Use Redis adapter to run Action Cable in production# gem 'redis', '~> 4.0'# Use ActiveModel has_secure_password# gem 'bcrypt', '~> 3.1.7'# Use ActiveStorage variant# gem 'mini_magick', '~> 4.8'# Use Capistrano for deployment# gem 'capistrano-rails', group: :development# Reduces boot times through caching; required in config/boot.rb# gem 'bootsnap', '>= 1.1.0', require: false# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Here is my config/database.yml:

default:&defaultadapter:jdbcmssqlpool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout:5000mode:dblibhost: <%= ENV.fetch("MSSQL_HOST") { 'localhost' } %>
  port: <%= ENV.fetch("MSSQL_PORT") { 1433 } %>
  username:SApassword:'!P4ssw0rd'development:<<:*defaultdatabase:development_mssql

Here is output when i run rbenv local:

$ rbenv local
jruby-9.2.0.0

Solution 2:

AR-JDBC does not support MS-SQL for AR >= 5.0 there simply wasn't enough resources to implement the SQLServer adapter.

however, the sqlserver adapter seems to have JRuby support these days. there's some minor details where it behaves differently, but not much to worry about (except that it might be noticeably slower due pure .rb parts).

Post a Comment for "Gem Load Error Is: Undefined Method `type_cast_from_database' For Class `arjdbc::mssql::uuidtype'"