on 2014 Jan 29 1:56 PM
I'm trying to use the DBI rubygem to connect with a Sybase database. I've installed the dbd-sqlanywhere gem, as well as the sqlanywhere gem but when I try to connect to the Sybase DB I get Could not load SQLAnywhere DLL (LoadError)
Why am I missing the library? Isn't that what the sqlanywhere gem is supposed to be?
I tried installing the driver from this site: http://www.sybase.com/detail?id=1087327 and it still hasn't resolved the issue.
IRB output:
$ irb 2.1.0 :001 > require 'dbi' => true 2.1.0 :002 > DBI.connect('DBI:SQLAnywhere:SERVER') LoadError: Could not load SQLAnywhere DLL from /home/jd/.rvm/gems/ruby-2.1.0/gems/dbd-sqlanywhere-1.0.1/lib/dbd/SQLAnywhere.rb:59:in `initialize' from /home/jd/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/singleton.rb:141:in `new' from /home/jd/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/singleton.rb:141:in `block in instance' from /home/jd/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/singleton.rb:139:in `synchronize' from /home/jd/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/singleton.rb:139:in `instance' from /home/jd/.rvm/gems/ruby-2.1.0/gems/dbd-sqlanywhere-1.0.1/lib/dbd/sqlanywhere/driver.rb:63:in `connect' from /home/jd/.rvm/gems/ruby-2.1.0/gems/dbi-0.4.5/lib/dbi/handles/driver.rb:33:in `connect' from /home/jd/.rvm/gems/ruby-2.1.0/gems/dbi-0.4.5/lib/dbi.rb:148:in `connect' from (irb):2 from /home/jd/.rvm/rubies/ruby-2.1.0/bin/irb:11:in `<main>' 2.1.0 :003 >
Request clarification before answering.
Perhaps a dumb question, but have you installed SQL Anywhere on your Linux box and run the .sa_config.[c]sh script (to set the SQLA environment variables) before trying to run your ruby test?
And always a question worth asking: What version / build of SQLA are you using? (although likely not relevant here)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have not run .sa_config.[c]sh.. I didn't see any instruction anywhere that mentioned that. Do you know where that would be located if I installed via the gem? I checked in ~/.rvm/gems/ruby-2.1.0/gems/sqlanywhere-0.1.6
and didn't see it anywhere.
Also the gem version is 0.1.6 according to that. I had tried installing SQL Anywhere 12.0.1
from the link in the question.
You need to install a version of SQL Anywhere on your linux box before you can use the SQLA Ruby driver. I.e. the ruby driver uses the client libraries included in the SQL Anywhere install to 'connect' to the database server - the ruby driver by itself cannot connect to the database server. After you run the install (from the link that you gave in your question) to lay down a copy of the Linux client libraries there will be an sa_config.sh (for sh/bash users) and sa_config.csh (for csh/tcsh users) in the bin32/bin64 directories. source one of these scripts (depending on which shell you use) to set the required environment variables (i.e. PATH, LD_LIBRARY_PATH, and SQLANY12). HTH
User | Count |
---|---|
68 | |
15 | |
12 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.