Btrieve/Pervasive db and Ruby

2019-04-17 15:00发布

Is there any solution to work with Btrieve/Pervasive db from Ruby level? Any gem? Maybe somebody have some experience with such a thing?

Or maybe use some Java libs through Jruby? I've never used Jruby

2条回答
欢心
2楼-- · 2019-04-17 15:39

Never worked with that, but if there's a JDBC adapter for it, then it's a good idea to use JRuby. Using JRuby is dead simple, visit JRuby.org.

查看更多
乱世女痞
3楼-- · 2019-04-17 15:43

@kell I used jruby and JDBC Pervasive driver. Simple example:

require "java"
module JavaSql
  include_package "java.sql"
end
pervasive_driver = Java::JavaClass.for_name("pervasive.jdbc.PervasiveDriver")
conn = JavaSql::DriverManager.getConnection("jdbc:pervasive://host/database","master","")
stmt = conn.createStatement
rs = stmt.executeQuery("select count(*) as class_count from class")
while (rs.next) do
  puts rs.get_string("class_count")
end
查看更多
登录 后发表回答