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

error when trying to connect to mongodb #91

Closed yanabar closed 8 years ago

yanabar commented 8 years ago

Hi there.. i was wondering if you could help me.. When running : mongify check database.config I'm getting the following error for the nosql connetion -same error applies when running the translation .. SQL connection works /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:66:in setup_connection_adapter': uninitialized constant Mongify::Database::NoSqlConnection::Connection (NameError) from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:76:inconnection' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:82:in has_connection?' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:100:incheck_nosql_connection' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:65:in execute' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/application.rb:28:inexecute!' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/bin/mongify:15:in <top (required)>' from /usr/local/bin/mongify:22:inload' from /usr/local/bin/mongify:22:in `

'

Let me know if you need more info from me .. the mongo db is hosted on mlab and I can access it online Has anyone else come across to this before?

anlek commented 8 years ago

It's hard to figure out without seeing your database.config file. Can you please share it (Just remove any passwords and IP addresses).

yanabar commented 8 years ago

sql_connection do adapter "mysql" host "" username "" password "" database "" batch_size 10000 end

mongodb_connection do host "" database "" end

yanabar commented 8 years ago

I have tried different options for mongo but nosql connection still errors

anlek commented 8 years ago

Can you give me the list of gems installed on your system? I think you might have a newer version of mongo gem.

yanabar commented 8 years ago

yes of course .. please see below: * LOCAL GEMS *

activemodel (3.2.22.2) activerecord (3.2.22.2) activerecord-mysql-adapter (0.0.1) activesupport (3.2.22.2) arel (3.0.3) bigdecimal (1.2.8) bson (4.0.4, 1.12.5, 1.10.2) bson_ext (1.12.5, 1.10.2) builder (3.0.4) bundler (1.11.2) chunky_png (1.3.5) compass (1.0.3) compass-core (1.0.3) compass-import-once (1.0.5) did_you_mean (1.0.0) ffi (1.9.10) highline (1.7.8) i18n (0.7.0) io-console (0.4.5) json (1.8.3) minitest (5.8.3) mongify (1.2.4) mongify-mongoid (1.0.4) mongo (2.2.4, 1.10.2) multi_json (1.11.2) mysql (2.9.1) net-telnet (0.1.1) power_assert (0.2.6) psych (2.0.17) rake (10.5.0, 10.4.2) rb-fsevent (0.9.7) rb-inotify (0.9.7) rdoc (4.2.1) rubygems-update (2.5.2) sass (3.4.21) test-unit (3.1.5) tzinfo (0.3.47)

yanabar commented 8 years ago

I have two versions of mongo gem: 2.2.4, 1.10.2 Do you think I should downgrade?

yanabar commented 8 years ago

Hi there! Do you have an update please ? I got stuck with this so I was wondering if you have any ideas. Let me know if you need anything else ..

anlek commented 8 years ago

Try removing the 2.2.4 mongo gem and see if it works.

yanabar commented 8 years ago

Success - Tyvm .. had to edit my database.config and now both SQL and NoSQL connections are working ! I am getting this also but I will investigate later: \ Notice: The native BSON extension was not loaded. **

  For optimal performance, use of the BSON extension is recommended.

  To enable the extension make sure ENV['BSON_EXT_DISABLED'] is not set
  and run the following command:

    gem install bson_ext

  If you continue to receive this message after installing, make sure that
  the bson_ext gem is in your load path.
anlek commented 8 years ago

So did it work once you downgraded the drivers?

As for the BSON extension issue. You can just do gem install bson_ext to make it go away. (And improve your mongo queries/inserts).

yanabar commented 8 years ago

sorry for the delay yes, I have downgraded mongo gem and had to update also the config file as it wouldn't like the one I was using earlier.

pasholvon commented 5 years ago

sorry for the delay yes, I have downgraded mongo gem and had to update also the config file as it wouldn't like the one I was using earlier.

Why wouldn't you include fixed config file? I hate ppl like this, solved the problem and didn't include the solution. Extremely selfish.