anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

Adapter Error for SQL Server #177

Closed ganesh3 closed 5 years ago

ganesh3 commented 5 years ago

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:inload' 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:inexecute!' 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:incheck_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:insetup_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:inspec' 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:inload_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:inrequire' 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)

ganesh3 commented 5 years ago

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:inload' 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:inexecute!' 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:incheck_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:insetup_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:inspec' 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. Addgem '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.

ganesh3 commented 5 years ago

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