This might not be the right place for this question, but I’m hoping
somebody here might be able to point me in the right (or even possibly
right) direction. I recently tried querying an MSSQL 2008 database from
Ruby. It works fine unless I use a parameterized query. As an example:
d = DBI.connect(‘DBI:ODBC:odbcdsn’, ‘name’, ‘pw’)
d.select_all “SELECT * FROM atable WHERE afield = ‘info’;”
=> [[7, ‘info’, 123]]
d.select_all “SELECT * FROM atable WHERE afield = ?;”, ‘info’
=> DBI::DatabaseError: INTERN (0) [RubyODBC]No data found
execute' from /usr/local/lib/ruby/gems/1.8/gems/dbi-0.4.3/lib/dbi/handles/database.rb:81:inexecute’
Does “INTERN (0)” indicate there’s a problem in compiled code somewhere?
This issue is happening on VMs with Debian Etch, Ruby 1.8.6, ruby-odbc
0.99994, Ruby DBI 0.4.3, FreeTDS 0.63, and unixODBC 2.2.11. Parts are
outdated, I know, but that’s what I’m stuck with for now.
I know it will work correctly on a Debian machine with Ruby 1.8.6,
ruby-odbc 0.99994, Ruby DBI 0.4.5, FreeTDS 0.82, and unixODBC 2.2.14.
I’ve been stuck on this problem for a while so I’m really just hoping
somebody has seen something similar or has any kind of suggestions on
where to look next. I’m guessing it’s an issue with FreeTDS or unixODBC.
I have no idea how to figure out which of those (if either) is causing
I’m also not sure I have a good understanding of how all this works
together. Is it correct to say that Ruby DBI uses ruby-odbc which uses
unixODBC which uses FreeTDS? And ruby-odbc is basically a Ruby wrapper
around unixODBC? If it is an issue in unixODBC, would I need to upgrade
unixODBC and then rebuild ruby-odbc?
Any advice would be very appreciated.