Has anyone actually gotten the activerecord-sybase-adapter to work in Rails2? I can''t seem to, and can''t figure out why. I am on RedHat linux. I have the sybase client libraries installed, I have the adapter installed. After installing the patch at https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2455-update-for-sybase_adapter#ticket-2455-4 to get a slightly better error message, my error message is now, well, not slightly better at all. RuntimeError: Please install the sybase adapter: gem install activerecord-sybase-adapter (no such file to load -- active_record/connection_adapters/sybase_adapter) from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection'' Yet of course I have the adapter installed, it''s just raising for some reason and this is what AR is telling me. I can''t quite figure out what to do next. If anyone''s actually gotten this to work on RHEL/Rails2, some tips would be much appreciated. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> Has anyone actually gotten the activerecord-sybase-adapter to work in > Rails2? >I''ve never had to suffer through doing this in Linux, but I had to suffer through doing it in Windows. Maybe this can help you a little? http://trevoke.net/blog/2009/09/11/connecting-to-sybase-with-rails-on-windows-xp/ -- Posted via http://www.ruby-forum.com/.
Yeah, that helped a little. The key is clearly that the AR sybase adapter depends not only on sybase client libraries being installed, but also on the ruby sybase-ctlib being installed. http://raa.ruby-lang.org/project/sybase-ctlib/ Kinda tricky to get that installed, but at least I know what I''ve got to do now. All of this stuff is awfully underdocumented, hopefully this thread will help someone. Aldric Giacomoni wrote:> > I''ve never had to suffer through doing this in Linux, but I had to > suffer through doing it in Windows. > Maybe this can help you a little? > http://trevoke.net/blog/2009/09/11/connecting-to-sybase-with-rails-on-windows-xp/-- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> Yeah, that helped a little. > > The key is clearly that the AR sybase adapter depends not only on sybase > client libraries being installed, but also on the ruby sybase-ctlib > being installed. http://raa.ruby-lang.org/project/sybase-ctlib/ > > Kinda tricky to get that installed, but at least I know what I''ve got to > do now. All of this stuff is awfully underdocumented, hopefully this > thread will help someone. >If I have time soon, which, sadly, is unlikely, I will try to get this working on an Ubuntu machine. I believe you''re right, and setting up ctlib will help you out. Let me know what works, in the end, and I''ll put that on my blog as well - because you''re right, this is very sadly underdocumented. -- Posted via http://www.ruby-forum.com/.
Aldric Giacomoni wrote:> If I have time soon, which, sadly, is unlikely, I will try to get this > working on an Ubuntu machine. I believe you''re right, and setting up > ctlib will help you out. Let me know what works, in the end, and I''ll > put that on my blog as well - because you''re right, this is very sadly > underdocumented.I _think_ I''ve got ctlib properly compiled (against freetds rather than Sybase''s own libraries, no less). but I can''t figure out where to PUT the products of the compile. the ctlib readme says: " Please copy sybct.o sybct.so sybct.rb sybsql.rb to somewhere of $LOAD_PATH." I am not sure what that means. Can''t figure out where to put those files where a Rails app will find them, and << require ''sybsql'' >> (a line in the AR adapter) won''t just say "no such file to load". Any ideas? It''s odd that sybase ctlib isn''t simply a gem in the first place. That would be a real service, if you wanted to make it into a gem. Although compiling it is still going to require some manual attention to the extconf.rb file depending on where your sybase client libraries are. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> I am not sure what that means. Can''t figure out where to put those files > where a Rails app will find them, and << require ''sybsql'' >> (a line in > the AR adapter) won''t just say "no such file to load". > > Any ideas?Mine are in C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt You probably have some i686 or i386 or i686-gcc directory there, instead of msvcrt.> > It''s odd that sybase ctlib isn''t simply a gem in the first place. That > would be a real service, if you wanted to make it into a gem. Although > compiling it is still going to require some manual attention to the > extconf.rb file depending on where your sybase client libraries are.Yeah.. I suppose I -could- try that, but I''m just a dumb SA/DBA who tries to go above and beyond the call of duty. The idea crossed my mind before, maybe I do know just enough Ruby to get in trouble with that now. -- Posted via http://www.ruby-forum.com/.
Aldric Giacomoni wrote:> Mine are in C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt > You probably have some i686 or i386 or i686-gcc directory there, instead > of msvcrt.Awesome, thanks, I''m on unix (Red Hat Linux), but this gave me some ideas to translate to the analagous location. I had TRIED putting them in /usr/lib/ruby/site_ruby/1.8/lib. That did NOT work. (I wonder what this dir is even doing there -- it was already there, I didn''t create it -- and what it''s for? Just to mislead me into making a reasonable but wrong guess about where to put stuff! ) I moved them to /usr/lib/ruby/site_ruby/1.8/x86_64-linux/ .... bah, still does not work. How very annoying. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> > I moved them to /usr/lib/ruby/site_ruby/1.8/x86_64-linux/ .... bah, > still does not work. > > How very annoying.Alright; can you show me, in a simple ruby program, how you are connecting? Also, are you connecting to Sybase ASE? Did you do something like this: gem install activerecord-sybase-adapter -s http://gems.rubyonrails.org require ''activerecord'' ActiveRecord::Base.establish_connection( :stuff => more_stuff ) ? -- Posted via http://www.ruby-forum.com/.
Okay, I figured out my problem with the help of "ruby -e ''puts $:''". I had a number of site_ruby directories that LOOKED legit, but weren''t actually in the load path, who knows. But it''s STILL not actually working. So, no, Aldric, I can''t show you in a simple ruby program how I''m connecting, because it''s still not working, heh. But to get CLOSE to working, I had to: 1) Install the OpenTds libraries 2) Install the ruby sybase-ct libraries. That was the tricky part, and I _think_ they''re properly installed now. 3) Then we go into to "gem install active-record-sybase-adapter", yes. And your ActiveRecord::Base.establish_connection example. Which for me, STILL, even now that I''m pretty sure I have ruby sybase-ct installed properly, just says: ActiveRecord::Base.establish_connection(:adapter => ''sybase'') RuntimeError: Please install the sybase adapter: `gem install activerecord-sybase-adapter` (no such file to load -- active_record/connection_adapters/sybase_adapter) from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection'' And, yes, I have the gem installed. Beleive it or not, before I had the gem installed, it was a DIFFERENT error. Aldric Giacomoni wrote:> Alright; can you show me, in a simple ruby program, how you are > connecting? > Also, are you connecting to Sybase ASE? > Did you do something like this: > > gem install activerecord-sybase-adapter -s http://gems.rubyonrails.org > > require ''activerecord'' > > ActiveRecord::Base.establish_connection( > :stuff => more_stuff ) > ?-- Posted via http://www.ruby-forum.com/.
Ha! I just got it to work! I had some cruft in ~/.gem. Deleted all that, finally it SEEMS to be working. Or at least I''m on to a new level. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> Ha! I just got it to work! > > I had some cruft in ~/.gem. Deleted all that, finally it SEEMS to be > working. Or at least I''m on to a new level.I am hanging to the edge of my seat; like Tim Curry would say, shivering with antici... pation. Please let us know the next and hopefully closing chapter in the saga! -- Posted via http://www.ruby-forum.com/.
Aldric Giacomoni wrote:> I am hanging to the edge of my seat; like Tim Curry would say, shivering > with antici... pation. > Please let us know the next and hopefully closing chapter in the saga!Well, I''m afraid I still don''t actually have a Sybase connection working. Trying to initiate a connection from AR, it waits like 20 seconds then reports "Connection Failed". I have no firewall in the way. Don''t know if the software didn''t compile right or what. Sigh. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> I have no firewall in the way. Don''t know if the software didn''t compile > right or what. Sigh.Geez, it may be that the ruby sybase-ctlib oddly seems to have NO facility for specifying what port to connect to Sybase on? I think my Sybase might be on a non-standard port, 2025. I think the port isn''t making it into the attempt to connect. How could this have been left out? Man oh man. Maybe I''m misinterpreting. But looking at the code in ruby sybase-ctlib, and can''t find any way to specify a port -- which would give the ActiveRecord sybase connector know way to pass on the port info. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> Jonathan Rochkind wrote: > >> I have no firewall in the way. Don''t know if the software didn''t compile >> right or what. Sigh. > > Geez, it may be that the ruby sybase-ctlib oddly seems to have NO > facility for specifying what port to connect to Sybase on? I think my > Sybase might be on a non-standard port, 2025. I think the port isn''t > making it into the attempt to connect. > > How could this have been left out? Man oh man. Maybe I''m > misinterpreting. But looking at the code in ruby sybase-ctlib, and can''t > find any way to specify a port -- which would give the ActiveRecord > sybase connector know way to pass on the port info.Did you see how my original tutorial involves editing an SQL.ini file ? Can you try that? -- Posted via http://www.ruby-forum.com/.
Is Sybase free? Why I would choose sybase instead of MySQL? Does someone has a good link with Sybase tutorial? Thank you! :]
Aldric Giacomoni wrote:> Did you see how my original tutorial involves editing an SQL.ini file ? > Can you try that?Thanks, I believe that is indeed the key, and would work. But the complexity of getting this working (Two different compiled packages, confusing configuration, needing to configure connections outside of the ruby app itself, etc) is making me re-think my whole approach to accessing my legacy Sybase database. Jonathan -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> Aldric Giacomoni wrote: > >> Did you see how my original tutorial involves editing an SQL.ini file ? >> Can you try that? > > Thanks, I believe that is indeed the key, and would work. But the > complexity of getting this working (Two different compiled packages, > confusing configuration, needing to configure connections outside of the > ruby app itself, etc) is making me re-think my whole approach to > accessing my legacy Sybase database. > > JonathanYou would most likely want to transfer all the data to a mySQL or PostgreSQL database (possibly renaming the id fields to railsify the whole thing) and then not touch the Sybase DB again. Maybe get a Windows box or VM, just long enough to do what you want (30-day trial for Windows) ? -- Posted via http://www.ruby-forum.com/.
Aldric Giacomoni wrote:> You would most likely want to transfer all the data to a mySQL or > PostgreSQL database (possibly renaming the id fields to railsify the > whole thing) and then not touch the Sybase DB again. > > Maybe get a Windows box or VM, just long enough to do what you want > (30-day trial for Windows) ?Nice idea, but this is a legacy enterprise database used by other software, not so easy to abandon it. My new plan (not really related to this thread, but perhaps useful for someone thinking about these things) is to write a web service in Java (there is already plenty of java code to talk to this db) that provides just the information needed by my ruby app (not actually the entirety of the database, not even close, just a few pieces of info, almost entirely read-only, for a few specific use cases) -- and just have the ruby app consume the web service instead. -- Posted via http://www.ruby-forum.com/.
Jonathan Rochkind wrote:> My new plan (not really related to this thread, but perhaps useful for > someone thinking about these things) is to write a web service in Java > (there is already plenty of java code to talk to this db) that provides > just the information needed by my ruby app (not actually the entirety of > the database, not even close, just a few pieces of info, almost entirely > read-only, for a few specific use cases) -- and just have the ruby app > consume the web service instead.Good luck! Sorry you spent so much time on this. Maybe I -will- try to develop some kind of gem for this, but don''t hold me to it.. It''s low on my list of priorities, and I don''t have the skills required to just put it all together. -- Posted via http://www.ruby-forum.com/.