anlek/mongify

Adapter Error for SQL Server

Closed this issue · 2 comments

Hi Andrew,

I am getting an error for specifying the Adapater as 'sqlserver'. Is SQL Server not supported? If it is, please let me know what should be the adapter name.

database.config file & error details below (most details masked for obvious reasons):

sql_connection do
adapter "sqlserver"
host "..."
username ""
password "
"
database "
********"
batch_size 10000 # This is defaulted to 10000 but in case you want to make that smaller (on lower RAM machines)

Uncomment the following line if you get a "String not valid UTF-8" error.

encoding "utf8"

end

mongodb_connection do
host "**************"
database "*******"

Uncomment the following line if you get a "String not valid UTF-8" error.

encoding "utf8"

end

mongify check database.config
Traceback (most recent call last):
14: from D:/Ruby25/bin/mongify:23:in <main>' 13: from D:/Ruby25/bin/mongify:23:in load'
12: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/bin/mongify:17:in <top (required)>' 11: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:in execute!'
10: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in execute' 9: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:in check_sql_connection'
8: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:56:in has_connection?' 7: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:40:in setup_connection_adapter'
6: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_handling.rb:50:in establish_connection' 5: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/connection_specification.rb:175:in spec'
4: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:274:in require' 3: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:240:in load_dependency'
2: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:274:in block in require' 1: from D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require'
D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': Could not load 'active_record/connection_adapters/sqlserver_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)

Got the above issue resolved by installing active record for sql sever as : 'gem install activerecord-sqlserver-adapter'

Now I am getting another error:

mongify check database.config
Traceback (most recent call last):
10: from D:/Ruby25/bin/mongify:23:in <main>' 9: from D:/Ruby25/bin/mongify:23:in load'
8: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/bin/mongify:17:in <top (required)>' 7: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:in execute!'
6: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in execute' 5: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:in check_sql_connection'
4: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:56:in has_connection?' 3: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:40:in setup_connection_adapter'
2: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_handling.rb:50:in establish_connection' 1: from D:/Ruby25/lib/ruby/gems/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/connection_specification.rb:174:in spec'
D:/Ruby25/lib/ruby/gems/2.5.0/gems/activerecord-4.2.11/lib/active_record/connection_adapters/connection_specification.rb:177:in rescue in spec': Specified 'sqlserver' for database adapter, but the gem is not loaded. Add gem 'activerecord-jdbc-adapter'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

Installed 'activerecord-jdbc-adapter' successfully but I am still getting the above error. Please help.

Reverted Ruby to 2.2.6 version and used adapter as 'sqlite3' which helped and the connections worked.