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

Mongify check database error #164

Closed cabrinoob closed 6 years ago

cabrinoob commented 6 years ago

Hi, I tried to make mongify work on my Windows 10. It fails I tried to make it work inside a container (ubuntu) and it fails with the same error.

/usr/local/bundle/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in rescue in spec': Specified 'mysql' for database adapter, but the gem is not loaded. Addgem 'mysql'to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) from /usr/local/bundle/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:inspec' from /usr/local/bundle/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in establish_connection' from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/database/sql_connection.rb:40:insetup_connection_adapter' from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/database/sql_connection.rb:56:in has_connection?' from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/command/worker.rb:95:incheck_sql_connection' from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/command/worker.rb:64:in execute' from /usr/local/bundle/gems/mongify-1.3.0/lib/mongify/cli/application.rb:28:inexecute!' from /usr/local/bundle/gems/mongify-1.3.0/bin/mongify:15:in <top (required)>' from /usr/local/bundle/bin/mongify:22:inload' from /usr/local/bundle/bin/mongify:22:in `

'

I followed the getting started guide.

I installed ruby/gem for windows with the dev-kit. I tried v2.4 or v2.2. Same problem. In my "dockerized" ubuntu, I tried apt-get install ruby-full or via RVM, I always have this error.

I'd just like to try mongify, so I have a mongo database running in a docker container and a mysql database also running in a docker container. They are both working fine.

What I have missed?

Thank you

adekunleba commented 6 years ago

I encountered a similar issue when working with Postgres Database and from the Gitter chat room I saw that you may need to install the adapter for MySQL. A similar approach for MySQL should have something like this:

I hope this works!

Jankko commented 6 years ago

Hi Cabri, Could you solved the problem? I have the same problem from centos 7.

anlek commented 6 years ago

@jankko, running gem install mysql should fix your problem. (You'll will also need to have mysql installed on that system)

Jankko commented 6 years ago

I have already installed that gem, I using Mariadb

anlek commented 6 years ago

and you are still getting that issue?

Jankko commented 6 years ago

yeah, I share my environment. MongoDB and MariaDB in CentoOS 7 Ruby 2.0.0p648 in CentOS 7 Ruby 2.4.4p296 in Windows 7 to try to conect to centOS 7.

When I create the database.conf I can create this file in any path or need it some specific file or location in the mongify gem?

anlek commented 6 years ago

I'm not sure i understand the "Sharing environment" part. If the both DBs are on CentOS 7, are you running mongify on CentOS?

Jankko commented 6 years ago

C:\Ruby24-x64\mongify>mongify check database.conf C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activerecord-4.2.10/lib/active_record/con nection_adapters/connection_specification.rb:177:in rescue in spec': Specified 'mysql' for database adapter, but the gem is not loaded. Addgem 'mysql'to yo ur Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activerecord-4.2.10/lib/acti ve_record/connection_adapters/connection_specification.rb:174:inspec' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activerecord-4.2.10/lib/acti ve_record/connection_handling.rb:50:in establish_connection' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/lib/mongify/da tabase/sql_connection.rb:40:insetup_connection_adapter' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/lib/mongify/da tabase/sql_connection.rb:56:in has_connection?' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/lib/mongify/cl i/command/worker.rb:99:incheck_sql_connection' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/lib/mongify/cl i/command/worker.rb:68:in execute' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/lib/mongify/cl i/application.rb:28:inexecute!' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mongify-1.3.2/bin/mongify:17 :in <top (required)>' from C:/Ruby24-x64/bin/mongify:23:inload' from C:/Ruby24-x64/bin/mongify:23:in `

'

Jankko commented 6 years ago

I test Mongify in CentOS 7 and Windows 7 and in both a get the same error.

Jankko commented 6 years ago

[root@localhost mongify]# mongify check database.config /usr/local/share/gems/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:177:in rescue in spec': Specified 'mysql' for database adapter, but the gem is not loaded. Addgem 'mysql'to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) from /usr/local/share/gems/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:174:inspec' from /usr/local/share/gems/gems/activerecord-4.2.10/lib/active_record/connection_handling.rb:50:in establish_connection' from /usr/local/share/gems/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:40:insetup_connection_adapter' from /usr/local/share/gems/gems/mongify-1.3.2/lib/mongify/database/sql_connection.rb:56:in has_connection?' from /usr/local/share/gems/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:99:incheck_sql_connection' from /usr/local/share/gems/gems/mongify-1.3.2/lib/mongify/cli/command/worker.rb:68:in execute' from /usr/local/share/gems/gems/mongify-1.3.2/lib/mongify/cli/application.rb:28:inexecute!' from /usr/local/share/gems/gems/mongify-1.3.2/bin/mongify:17:in <top (required)>' from /usr/local/bin/mongify:23:inload' from /usr/local/bin/mongify:23:in `

'

anlek commented 6 years ago

and both had gem install mysql ran?

Jankko commented 6 years ago

yeah, how I add the mysql gem to Gemfile of Mongify?

Jankko commented 6 years ago

In CentOS I have this problems: [root@localhost mongify-1.3.2]# gem install mysql ERROR: Could not find a valid gem 'mysql' (>= 0) in any repository [root@localhost mongify-1.3.2]# gem sources --add https://rubygems.org/ Error fetching https://rubygems.org/: SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://rubygems.org/specs.4.8.gz) [root@localhost mongify-1.3.2]#

Jankko commented 6 years ago

In Windows 7 : C:\Ruby24-x64\lib\ruby\gems\2.4.0\gems\mongify-1.3.2>gem install mysql Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mysql-2.9.1/ext/my

sql_api C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20180614-312-1i3yzhr.rb extconf.rb checking for -llibmysql... no extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby24-x64/bin/$(RUBY_BASE_NAME) --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-libmysqllib --without-libmysqllib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/mysql-2.9.1/mkm f.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mysql- 2.9.1 for inspection. Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0 /mysql-2.9.1/gem_make.out

anlek commented 6 years ago

I'd have to say, it might not work in windows, it wasn't originally designed to run under windows...

cabrinoob commented 6 years ago

Even in a container? Under windows, but in a container ?

Jankko commented 6 years ago

ok share me the environment for mongify. os,database,ruby version,etc all that I need.

anlek commented 6 years ago

It should work fine in ubuntu 16.04, Ruby 2.2, mysql and mongodb version 3.2 or earlier.

Jankko commented 6 years ago

With Ubuntu 16.04 and Ruby 2.2 I cant install the mongifiy gem Building native extensions. This could take a while... ERROR: Error installing mongify: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.2 -r ./siteconf20180616-4140-1hutsd3.rb extconf.rb

checking for asprintf()... extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/$(RUBY_BASE_NAME)2.2 /usr/lib/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/lib/ruby/2.2.0/mkmf.rb:541:intry_link0' from /usr/lib/ruby/2.2.0/mkmf.rb:556:in try_link' from /usr/lib/ruby/2.2.0/mkmf.rb:735:intry_func' from /usr/lib/ruby/2.2.0/mkmf.rb:1020:in block in have_func' from /usr/lib/ruby/2.2.0/mkmf.rb:911:inblock in checking_for' from /usr/lib/ruby/2.2.0/mkmf.rb:351:in block (2 levels) in postpone' from /usr/lib/ruby/2.2.0/mkmf.rb:321:inopen' from /usr/lib/ruby/2.2.0/mkmf.rb:351:in block in postpone' from /usr/lib/ruby/2.2.0/mkmf.rb:321:inopen' from /usr/lib/ruby/2.2.0/mkmf.rb:347:in postpone' from /usr/lib/ruby/2.2.0/mkmf.rb:910:inchecking_for' from /usr/lib/ruby/2.2.0/mkmf.rb:1019:in have_func' from extconf.rb:3:in

'

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.2.0/gems/bson_ext-1.12.5 for inspection. Results logged to /var/lib/gems/2.2.0/extensions/x86_64-linux/2.2.0/bson_ext-1.12.5/gem_make.out

anlek commented 6 years ago

@Jankko You need to have the dev tools installed:

sudo apt-get install build-essential

Read more at https://tecadmin.net/install-development-tools-on-ubuntu/

Jankko commented 6 years ago

image I got it I done. Thank you @anlek

anlek commented 6 years ago

Awesome! Good luck with your move

Faizan227 commented 5 years ago

is the driver for SQL and mysql is same or i have to also install the SQL driver. i am connecting NoSQL successfully but the only error i am getting is the missing software. can you gus please help me in this regard.