Takaaki Tateishi wrote:
> Richard Cole wrote:
>
>> Hi. Quick question. I've install a database like thingy (kowari)
>> written in Java that I want to communicate with from a Ruby: send
>> queries get answers. What's a good way to communicate from a ruby
>> process to Java process, SOAP? RMI? Corba? A socket? Are there any
>> wrappers that let me go from ruby straight to the JVM presumably via
>> the java native call interface?
>
>
> Try rjb,
> http://arton.no-ip.info/data/rjb-0.1.9.zip
> http://arton.no-ip.info/collabo/back...RubyJavaBridge
Wow, cool library. That was just what I was looking for

. Can you
think of any reason why I'm getting a SIGHUP? Here's my short ruby
program, maybe there's something obvious.
----
require 'rjb'
include Rjb
def file_contents_of(filename)
result = nil
File.open(filename) { |file| return file.read() }
return result
end
queryString = file_contents_of('example.itql')
load("itql-1.1.0.jar")
iTQLInterpreterBeanClass = import('org.kowari.itql.ItqlInterpreterBean')
iTQL = iTQLInterpreterBeanClass.new
answer = iTQL.executeQuery(queryString)
vars = answer.getVariables
while answer.next do
for i in 1..vars.length do
puts "i=#{i} val=#{answer.getObject(i-1).toString()}"
end
end
----
Output is:
[snip]
i=1 val=gr

rg.apache.bcel.classfile.Signature%24MyByt eArrayInputStream
i=1 val=gr:java.io.ByteArrayInputStream
itql.rb:19: SIGHUP (SignalException)
Each time I run the program the SIGHUP comes either on answer.next or
answer.getObjects... and with a different amount of output.
regards,
Richard.