views:

363

answers:

1

I have been trying to get ruby 1.8.6 to connect to a MS SQL Server 2005 on Mac OS X snow leopard following the guide here http://wiki.rubyonrails.org/database-support/ms-sql. I have installed the Ruby ODBC Bindings and the dbi and dbd-odbc gems and ruby was compiled from source.

If I run this in irb, DBI.connect('dbi:ODBC:A_DSN', 'USERNAME', 'PWD' ), the ruby process just hangs indefinitely.

I have used gdb to look at the hung process and it is stuck on semaphore_wait_signal_trap.

If I compile ruby 1.8.7 and install the odbc bindings in the same way everything works fine, so I am not sure if it is an issue with compiling the bindings in snow leopard or not. I was able to get this to work on OS X 10.5 and ruby 1.8.6 before upgrading to snow leopard.

Thanks for any light that can be shed!

+1  A: 

This looks like the same issue as this: http://www.ruby-forum.com/topic/196606

I'm trying to sort this one out for myself so I'll let you know if I make any progress.

...

I think I'm getting near a solution, but you'll probably have to patch your 1.8.6 source tree before compiling. Looking at dln.c it seems that 1.8.6 uses the deprecated object file image functions NSLinkModule, etc. rather than dlopen. I'm betting that the optimisations for dyld in 10.6 have broken backward compatibility in some way. Therefore I intend to patch my 1.8.6 installation to use dlopen and see whether that fixes the problem.

...

Yep, backporting the dln.c changes from 1.8.7 to 1.8.6 fixes the load problem with RMagick so I'd bet that it would also fix your problem.

pixeltrix
Thanks! Backporting dln.c also worked for me.
calstad