I am attempting to make use of the KirbyBase (in Ruby) in server/client mode and getting some problems... Here's the setup (I am using a speacilized embedded a linux systemunix (described at the end of publish) but I'll call individuals PC for that arguments sake)

  • 2 Computers utilizing an NFS mounted NAS drive on network (installed on /mnt/sharedSpace), you will be server and also the other client...
  • I've 2 formerly produced tables named 'history.tbl' and 'registeredTags.tbl' in /mnt/sharedSpace/data

Here's the server code:

# Multi-user server script for KirbyBase.

require 'DatabaseObjects.rb'
include DatabaseObjects
require 'kirbybase'
require 'drb'

puts 'Initializing database server and indexes...'

# Create an instance of the database.
db = KirbyBase.new(:server,nil,nil,'/mnt/sharedSpace/data/')

DRb.start_service('druby://:44444', db)

puts 'Server ready to receive connections...'


And below may be the client code:

require 'kirbybase'
require 'DatabaseObjects.rb'
require 'drb'
include DatabaseObjects
    db = KirbyBase.new(:client, '', 44444)
    if db.table_exists?(:registeredTags)
        puts "found table"
        registeredTagsTable = db.get_table(:registeredTags)
        puts "got table"
        puts registeredTagsTable.select().to_report
        puts "couldnt found table"
rescue Exception => sp
    puts sp.message
    puts sp.backtrace.inspect

I start the server also it prints 'Server ready..........' i quickly start the customer code alternatively machine and this is what I recieve:

undefined method `close' for nil:NilClass
["(druby:// /usr/lib/ruby/1.8/kirbybase.rb:1765:in `with_table'", "(druby:// /usr/lib/ruby/1.8/kirbybase.rb:992:in `get_header_vars'", "/usr/lib/ruby/1.8/kirbybase.rb:3112:in `update_header_vars'", "/usr/lib/ruby/1.8/kirbybase.rb:2026:in `initialize'", "/usr/lib/ruby/1.8/kirbybase.rb:2002:in `new'", "/usr/lib/ruby/1.8/kirbybase.rb:2002:in `create_called_from_database_instance'", "/usr/lib/ruby/1.8/kirbybase.rb:463:in `initialize'", "/usr/lib/ruby/1.8/kirbybase.rb:461:in `each'", "/usr/lib/ruby/1.8/kirbybase.rb:461:in `initialize'", "draft.rb:6:in `new'", "draft.rb:6"]

But when I start exactly the same client code on a single machine because the server code is running on, everything goes easily also it prints the table contents. Any ideas...?

System explanation as asked for by some: The unit I am dealing with is definitely an intelligent RFID readers, by having an embedded linux arm based computer on-board. The only real api/language manufacturer enables and offers (w/o escaping . of license terms) is ruby, plus they give no-support for setting up extra-stuff and they've personalized the kernel in device to create setting up/producing anything as hard as you possibly can. I'm able to use extra ruby stuff if they are just .rb lib files that's I'm able to easily just include them during my code, but something that requires producing is really a no-no. Also, this technique doesn't have jewel.

Edit2: Respond for first answer, I've transformed the stated work as following:

def with_table(table, access='r')
        yield fptr = open(table.filename, access)
        if !fptr.nil? then

And today I am getting this error:

druby://localhost.localdomain:1027 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>
["(druby:// /usr/lib/ruby/1.8/drb/drb.rb:736:in `open'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:729:in `each'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:729:in `open'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1196:in `initialize'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1176:in `new'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1176:in `open'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1092:in `method_missing'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1110:in `with_friend'", "(druby:// /usr/lib/ruby/1.8/drb/drb.rb:1091:in `method_missing'", "(druby:// /usr/lib/ruby/1.8/kirbybase.rb:1763:in `with_table'", "(druby:// /usr/lib/ruby/1.8/kirbybase.rb:992:in `get_header_vars'", "/usr/lib/ruby/1.8/kirbybase.rb:3114:in `update_header_vars'", "/usr/lib/ruby/1.8/kirbybase.rb:2028:in `initialize'", "/usr/lib/ruby/1.8/kirbybase.rb:2004:in `new'", "/usr/lib/ruby/1.8/kirbybase.rb:2004:in `create_called_from_database_instance'", "/usr/lib/ruby/1.8/kirbybase.rb:463:in `initialize'", "/usr/lib/ruby/1.8/kirbybase.rb:461:in `each'", "/usr/lib/ruby/1.8/kirbybase.rb:461:in `initialize'", "draft.rb:6:in `new'", "draft.rb:6"]