views:

119

answers:

2

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

A: 

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.

khelll
A: 

@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
Sebastian