RubyODBC cannot allocate SQLHENV

I am trying to connect to SQL Server on Ubuntu 9.04 using Ruby. I translated and completed all the steps outlined in how to get OSX to talk to SQL Server:

http://toolmantim.com/articles/getting_rails_talking_to_sqlserver_on_osx_via_odbc

Everything works on FreeTDS and unixODBC content. I see and query the database using tsql.

When I try to access a database from Ruby using IRB, I get the following error:

DBI :: DatabaseError: INTERN (0) [RubyODBC] Unable to allocate SQLHENV

Does anyone come across this and what can I do to solve this problem?

+5
source share
7 answers

, . , , libdbd-odbc-ruby libdbi-ruby, , libdbi-ruby, libdbd-odbc-ruby. , , - .

0

, Ubuntu 9.10 (Karmic Koala). Ubuntu .

, ruby-odbc.

wget http://www.ch-werner.de/rubyodbc/ruby-odbc-0.9997.tar.gz
tar xzvf ruby-odbc-0.9997.tar.gz
cd ruby-odbc-0.9997
ruby extconf.rb --with-dlopen
make
sudo make install
+5

Ubuntu 9.10 64

odbc rubyodbc

wget http://www.ch-werner.de/rubyodbc/ruby-odbc-0.9997.tar.gz
tar xzvf ruby-odbc-0.9997.tar.gz
cd ruby-odbc-0.9997
ruby extconf.rb --with-odbc-dir=/usr/lib/odbc --disable-dlopen
make
sudo make install
+2

.

Centos 5.5 Ubuntu

/ .

unixODBC. LD_LIBRARY_PATH. , /etc/ld.so.conf.d/odbc.conf. unixODBC ie/usr/local/lib. , sudo ldconfig.

+1

BTW, Ruby-ODBC Ubuntu 9.10 (Karmic), libiodbc2-dev, unixodbc-dev. libiodbc2-dev , Ruby :

connection.select_all('select top 15 * from log_device_healths')

.. unixodbc-dev.

0

, , . -, .

sudo gem uninstall ruby-odbc
sudo rm /usr/local/lib/site_ruby/1.8/x86_64-linux/odbc.so
cd /tmp
wget http://mirrors.kernel.org/ubuntu/pool/universe/libo/libodbc-ruby/libodbc-ruby1.8_0.9995-1_amd64.deb
sudo dpkg -i libodbc-ruby1.8_0.9995-1_amd64.deb

If you are not on a 64-bit platform, you need to download another Debian package.

Basically, the solution to this problem is to install version 0.9995 of the ruby-odbc Ubuntu package.

0
source

All Articles