# RubyODBC bus error under Rails

**URL:** <https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982>\
**Category:** Rails\
**Created:** [May 30, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982 "2006-05-30T15:24:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![surplustronics](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@surplustronics](https://www.ruby-forum.com/u/surplustronics)\
**Post date:** [May 30, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982/1 "2006-05-30T15:24:32Z")

</div>

Hi all,

I’ve got a very obscure problem. We’re trying to get Rails to talk to  
Filemaker. So we’ve setup an ODBC dsn and via RubyODBC we’re talking  
to it. Excellent. Try it under rails and rails won’t even startup,  
getting bus errors anytime we require ‘odbc’.

Environment  
OSX Tiger 10.4.6  
Rails 1.1.2  
Ruby 1.8.4  
RubyODBC 0.998

via IRB:  
irb(main):001:0\> require ‘odbc’  
=\> true

via Rails (in environment.rb added require ‘odbc’)  
rowanh$ script/console  
Loading development environment.  
/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.5.0/ODBC.bundle:  
[BUG] Bus Error  
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.5.0]

Abort trap  
OR  
rowanh$ script/server  
=\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server (see config/lighttpd.conf for options)  
/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.5.0/ODBC.bundle:  
Failed to lookup Init function  
/usr/local/lib/ruby/site\_ruby/1.8/powerpc-darwin8.5.0/ODBC.bundle  
(LoadError)  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’  
from /Users/rowanh/framework/public/…/config/environment.rb:9  
from /Users/r

Any thoughts/ideas ?

Many Thanks,

## Rowan

[www.rowanhick.com](http://www.rowanhick.com)

---

<div class="post-metadata">

**Author:** ![surplustronics](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@surplustronics](https://www.ruby-forum.com/u/surplustronics)\
**Post date:** [May 30, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982/2 "2006-05-30T15:59:01Z")

</div>

On 30 May 2006, at 15:21, Rowan H. wrote:

> Ruby 1.8.4  
> RubyODBC 0.998

First of all, if you get it to work, please share it, I could really  
use it…

However, a very important remark: Filemaker ODBC sucks. It’s slow as  
hell, leaks memory and can even hang your entire system in the long  
run. At least, it was the case with filemaker 6 or lower. If you can,  
you better use Filemaker Web Companion (assuming you’re on Filemaker  
Server 5.5, you’ll also need a Filemaker client running your  
application) and try to parse Filemaker XML into a Rails-like  
structure. I once did some very preliminary tests, here’s the code of  
the ruby file (you’ll need to install xml-simple)

require ‘net/http’

begin  
require ‘xmlsimple’  
rescue LoadError  
begin  
require ‘rubygems’  
require\_gem ‘xml-simple’  
rescue LoadError  
abort \<\<-ERROR  
The ‘xml-simple’ library could not be loaded. If you have RubyGems  
installed  
you can install xml-simple by doing “gem install xml-simple”.  
ERROR  
end  
end

Net::HTTP.start(‘127.0.0.1’,80) do |query| # replace 80 with  
different port number if needed  
response=query.post("/FMPro","-db=FilemakerFileName.fp5&-format=-  
dso\_xml&-lay=layoutwithonlynecessaryfieldsforspeed&-max=all&-find")  
cfg = XmlSimple::xml\_in(response.body)  
p cfg  
cfg[“ROW”].each do |value|  
value.each do |key,value|  
puts key.to\_s+" - "+value.to\_s  
end  
end  
end

I would love to see someone write a wrapper class for Filemaker  
access (or a connection adapter for that matter), but it’s going to  
be a lot of work and time and a decent amount of ruby knowledge (i  
have neither :-)). I did write such classes for REALbasic a few years  
back and I can honestly say using Web Companion + XML really flies  
(FX.php also uses it btw).

Please keep me informed on your progress and don’t hesistate to call  
for help if you have questions about the XML itself!

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![surplustronics](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@surplustronics](https://www.ruby-forum.com/u/surplustronics)\
**Post date:** [May 30, 2006, 4:23pm UTC](https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982/3 "2006-05-30T16:23:39Z")

</div>

Hi Peter

Subsequent to this I’ve just tried loading odbc in the dispatch.fcgi  
file, so it’s the first thing that gets loaded and it works ! So we’ve  
got our connection up and running…

We’ve tried using the xml/xsl approach, the problem with it is:

- we have to do too much work everytime we want to expose something to  
rails (we have a huge legacy db that needs only snippets pulled).
- I also have to write as well as read (therefore posting as well)
- too many links in the chain

The theory at the moment is Rails sits ontop of MySQL with Filemaker  
off to the side. Initially our models will use the native RubyODBC  
stuff for talking to Filemaker, but as we do more work we’ll mold an  
ActiveRecord adaptor for it. It’s just figuring out what filemaker  
does/doesn’t support. Our models will decide what they want to  
cache/write to/from Filemaker on demand. Although we’re also looking  
at syncing directly the data required from Filemaker to Mysql without  
going through Rails.

My Filemaker guru tells me we’re on version 8 now, he said there were  
huge odbc improvements going from 6 to 7, so you can be sure we’ll let  
you know how we get on.

Cheers  
Rowan

On 5/30/06, Peter De Berdt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

>

---

<div class="post-metadata">

**Author:** ![surplustronics](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@surplustronics](https://www.ruby-forum.com/u/surplustronics)\
**Post date:** [May 30, 2006, 4:42pm UTC](https://www.ruby-forum.com/t/rubyodbc-bus-error-under-rails/61982/4 "2006-05-30T16:42:25Z")

</div>

> Subsequent to this I’ve just tried loading odbc in the dispatch.fcgi  
> file, so it’s the first thing that gets loaded and it works ! So we’ve  
> got our connection up and running…

Great, I thought of this just before seeing your message appear on  
the list

> We’ve tried using the xml/xsl approach, the problem with it is:
> 
> - we have to do too much work everytime we want to expose something to  
> rails (we have a huge legacy db that needs only snippets pulled).
> - I also have to write as well as read (therefore posting as well)
> - too many links in the chain

True, there was quite a lot of work involved to hide the drawbacks in  
my REALbasic classes too.

> The theory at the moment is Rails sits ontop of MySQL with Filemaker  
> off to the side. Initially our models will use the native RubyODBC  
> stuff for talking to Filemaker, but as we do more work we’ll mold an  
> ActiveRecord adaptor for it. It’s just figuring out what filemaker  
> does/doesn’t support. Our models will decide what they want to  
> cache/write to/from Filemaker on demand. Although we’re also looking  
> at syncing directly the data required from Filemaker to Mysql without  
> going through Rails.

There’s [Garrison Computer Services :: Products :: fmSQL Synch](http://www.garrison.com.au/products/fmsql_synch.html) but I  
haven’t tried it out. But it’d be very interesting to see a Rails  
integrated solution.

> My Filemaker guru tells me we’re on version 8 now, he said there were  
> huge odbc improvements going from 6 to 7, so you can be sure we’ll let  
> you know how we get on.

My former job was Filemaker 7/8 development, the job before was  
Filemaker 4/5/6 development. In my current job, I’m still supporting  
a very big Filemaker 6 solution, which we are converting to Rails/  
MySQL (because we’ve had it with Filemaker for a number of reasons,  
mostly speed, interoperability and licensing issues). I’ve had to  
deal with ODBC/JDBC a number of times, both in version 6 and 7/8.  
Filemaker Server Advanced has indeed succeeded in eliminating a  
number of ODBC issues.

Good luck, I wish you the best and am looking forward to your feedback!

Best regards

Peter De Berdt
