anlek/mongify

configuration file: database.config file for SQL SERVER 2014

Closed this issue · 4 comments

I am using mongify (http://mongify.com/) to migrate data from SQL SERVER 2014 to MongoDB. I have the following database.config file:

database.config:

sql_connection do
  adapter   "sqlserver"
  host      "<DATABASE SERVERNAME>"
  username  "<USERNAME>"
  password  "<PASSWORD>"
  database  "<DATABASENAME>"
end

mongodb_connection do
  host      "localhost"
  database  "<DATABASENAME>"
end

Based on the instructions mentioned in the portal I then tried to test the following command:

mongify check database.config

I got the following error:

C:/Ruby23/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Could not load 'active_record/connection_adapters/sqlserver_adapter_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)
        from C:/Ruby23/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/temp/.gem/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
        from C:/temp/.gem/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
        from C:/temp/.gem/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
        from C:/temp/.gem/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:175:in `spec'
        from C:/temp/.gem/gems/activerecord-4.2.10/lib/active_record/connection_handling.rb:50:in `establish_connection'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:40:in `setup_connection_adapter'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:56:in `has_connection?'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:in `check_sql_connection'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in `execute'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:in `execute!'
        from C:/temp/.gem/gems/mongify-1.3.2/bin/mongify:17:in `<top (required)>'
        from C:/temp/.gem/bin/mongify:23:in `load'
        from C:/v/.gem/bin/mongify:23:in `<main>'

Can anyone help me to fix this issue

I have installed gem install activerecord-sqlserver-adapter and here goes the list of installed gems in my system.

*** LOCAL GEMS ***

activemodel (5.1.6, 4.2.10)
activerecord (5.1.6, 4.2.10)
activerecord-sqlserver-adapter (5.1.6)
activesupport (5.1.6, 4.2.10)
arel (8.0.0, 6.0.4)
bigdecimal (1.2.8)
bson (1.12.5)
bson_ext (1.12.5)
builder (3.2.3)
bundler (1.15.4)
chunky_png (1.3.8)
compass (1.0.3)
compass-core (1.0.3)
compass-import-once (1.0.5)
concurrent-ruby (1.0.5)
did_you_mean (1.0.0)
ffi (1.9.18 x86-mingw32)
highline (1.7.8)
i18n (0.9.5)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.3)
mongify (1.3.2)
mongo (1.12.5)
multi_json (1.12.2)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.17)
rake (10.4.2)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
rdoc (4.2.1)
sass (3.4.25)
test-unit (3.1.5)
thread_safe (0.3.6)
tiny_tds (2.1.2 x86-mingw32)
tzinfo (1.2.5)

But still I am getting the below error on checking the command:
mongify check database.config

C:/temp/.gem/gems/activerecord-4.2.10/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-sqlserver-adapter'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
        from C:/temp/.gem/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
        from C:/temp/.gem/gems/activerecord-4.2.10/lib/active_record/connection_handling.rb:50:in `establish_connection'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:40:in `setup_connection_adapter'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:56:in `has_connection?'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:in `check_sql_connection'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in `execute'
        from C:/temp/.gem/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:in `execute!'
        from C:/temp/.gem/gems/mongify-1.3.2/bin/mongify:17:in `<top (required)>'
        from C:/temp/Sites/.gem/bin/mongify:23:in `load'
        from C:/temp/.gem/bin/mongify:23:in `<main>'
anlek commented

Hello,
I'm sorry to say but I am unable to help with SQL Server setups as I don't have access to a server to test. However, you can see other issues users have submitted regarding this, a good one to read is #96.

if you have not put the timeout parameter to database.config file then it gives this error. I think this is worked before versions of the ruby 3.2 but afterwards they added new features and this oppurtunuty failed. There i read someone solved this issure by wrapping this gem file with a new gem project. I dont know ruby and even i dont want to attempt to write a wrapper project for this process. If i need writing a new project for a solution for this i can write that propject any platform. This is very stupid..