Мне нужно использовать SQLite3 с гемом Jruby и Sequel в Windows.
require 'sequel'
DB = Sequel.sqlite
Я получил эту ошибку:
Sequel::AdapterNotFound: LoadError: no such file to load -- sqlite3
load_adapter at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/database/connecting.rb:93
adapter_class at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/database/connecting.rb:17
connect at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/database/connecting.rb:45
connect at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/core.rb:116
adapter_method at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/core.rb:394
block in sqlite at C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sequel-5.9.0/lib/sequel/core.rb:401
<main> at test.rb:53
При попытке установить гем sqlite3 происходит сбой при сборкеСобственные расширения:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/sqlite3-1.3.1
3/ext/sqlite3
C:/jruby-9.1.13.0/bin/jruby.exe -r ./siteconf20181005-6576-1e4h1cf.rb extconf.rb
checking for sqlite3.h... RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.
try_do at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:456
try_cpp at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:587
block in find_header at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:1144
block in checking_for at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:942
block in postpone at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:350
open at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:320
block in postpone at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:350
open at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:320
postpone at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:346
checking_for at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:941
find_header at C:/jruby-9.1.13.0/lib/ruby/stdlib/mkmf.rb:1143
<main> at extconf.rb:50
*** 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:/jruby-9.1.13.0/bin/jruby
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/jruby-9.1.13.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sql
ite3-1.3.13/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/jruby-9.1.13.0/lib/ruby/gems/shared/gems/s
qlite3-1.3.13 for inspection.
Results logged to C:/jruby-9.1.13.0/lib/ruby/gems/shared/extensions/universal-ja
va-1.8/2.3.0/sqlite3-1.3.13/gem_make.out
Я скопировал библиотеку SQLite (sqlite3.dll, sqlite3.def) в папку jruby / bin.
Служебная страница официальной страницы JRuby использует activerecord-jdbc-адаптер,но мне нужно создать в памяти дб, не подключаясь к существующему.
Как мне это сделать?
Мое окружение:
Jruby v. 9.1.13
Sequel v.5.9.0
Windows Server 2012 R2