Btrieve/Pervasive db and Ruby

喜夏-厌秋 提交于 2019-12-06 15:55:33

问题


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


回答1:


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.




回答2:


@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


来源:https://stackoverflow.com/questions/1432026/btrieve-pervasive-db-and-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!