Connecting to MSSQL from Ruby on Rails from Ubuntu - ruby

The title sums up the whole problem.
To use RoR, I was suggested to use Linux, so I got a VirtualBox and got Ubuntu 13 on it, installed RVM and RoR and now I'm pretty stuck.
I need to access the MSSQL from Ruby from inside the Ubuntu, and I don't have a single clue.
A question of relevance was this question, but the answer links seemed to have expired, and the one that isn't, I can't make out a method of how to do it.
Any approach suggestions?

Its very simple if you use freetds. Install freetds library. Its available in ubuntu repository.
sudo apt-get install freetds
Then follow the instructions here

Related

How to install libraries (mysql connector cpp) on Mac using terminal and make things simple as in the case of Ubuntu

I will share an example.
I had to install mysql connector c++ libraries for my project.
To install connector c++ on my Mac, i had to build it from the source code and it takes a lot of effort because you get errors sometimes and then it is troublesome, something which should have been done in a short time.
In case of Ubuntu, I just had to write one command in the terminal, and wow, everything just got done automatically.
apt-get install libmysqlcppconn7
Does anybody know any similar command in mac, using brew or macports?
I tried to find but I guess I didn't get any results to satisfaction.
And if there is not, can anyone guide me so that I can make it possible, like I think it's possible for mac, if it is possible in ubuntu.
Please guide me, an answer in a bit detail would be so much appreciated.
Probably the nearest thing to apt-get on a mac is brew
Once it is set up (and this isn't difficult) "brew install mysql-connector-c++" will install on the mac

How Can I install ruby on Redhat? ruby package not found

I dont' know why I cannot install ruby through yum in my RHEL6.2
How can I fix it. I don't wanna install through source. Any idea?
[root#kithost ~]# yum install ruby
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
No package ruby available.
Error: Nothing to do
RVM is a solution but it is not that I want.
What I want to know is that once we can't find any package from yum, what kind of thing should we fix into order to let yum find it?
Probably the best way to install and manage Ruby is using RVM. Moreover, you can use more than one ruby versions using RVM. I can bet, it's really something you may love it. Yum is sometime a curse :-).
Follow their installation guide as there are different methods of (with pros and cons) installations and choose your preferred one. I'm pretty sure, you will love it too.
However, if you are still thinking to use it, you may follow this Guide. Be aware, I don't not know whether it works or not as I did not try it. Why should I try something else, when I'm already using BEST one :)!
Redhat does not have a free repo list unless you pay, or make subscription to them.
The reason for that I cannot install ruby is that there is no availalbe repo list
check
/etc/repo.list
you can copy the one from CentOS to Redhat.
Then your yum could search a available repo server and make your ruby downloadable.
RVM is a good solution but I found that rbenv was much better including when you have to use Ruby on a server.
You can find how to install rbenv in the README.

Why doesn't rails.vim recognize any gems that I install?

I'm a ruby and vim newbie. I recently installed the rails.vim plugin and all the commands work fine apart from the commands to create a new Rails project. Every time I do this it says rails is not installed on my system, but it is! It also acts up when I create a class that requires a gem that I've installed. Can anyone help with this?
Did you rvm use system before building / brew install-ing macvim? I didn't and got many errors. Doing rvm use system beforehand fixed things up for me.

Passenger installation with nginx fails

I'm running an ubuntu 9.10 server on an amd-64 platform. Everything's pretty much standard, and I've got Sinatra 0.94 running on a ruby 1.8 installation. I want to install passenger in order to easily configure ssl.
The problem is, it fails to find the installer.
I run
sudo gem install passenger
or
sudo gem install -r passenger
and then the next line,
passenger-install-nginx-module
or
passenger-install-apache2-module
both fail because the path isn't found.
Is there something I'm forgetting here? Shouldn't it just work, straight up, once the gem is installed?
A bit late for an answer I guess, but actually, the correct way of running the Phusion Passenger installer for nginx, when using RVM, is to use rvmsudo as in:
rvmsudo passenger-install-nginx-module
Credits go to this blog post,
I got it working with
rvmsudo `which passenger-install-nginx-module`
according to this issue on github: https://github.com/wayneeseguin/rvm/issues/1307
seems like you have to do full path:
this worked for me:
which passenger-install-nginx-module
rvmsudo ~/.rvm/gems/ruby-1.9.3-p327-new/gems/passenger-3.0.18/bin/passenger-install-nginx-module
apparently, the gem is installed in a place that's off the path, according to
http://groups.google.com/group/phusion-passenger/browse_thread/thread/78ca12c4838034a6/b5a3c7a00a871283?lnk=gst&q=ubuntu+9.10#b5a3c7a00a871283
Frustrating error, which is why I leave this question rather than delete it (and, with the upvote, I think I'm not the only one with the problem).
I had a similar issue. You need to add gems to your system PATH, paste this into your shell:
export PATH=$PATH:$HOME/bin:/var/lib/gems/1.8/bin
or, to make it permanent add it to your bashrc, usually here: ~/.bashrc
You can also execute just passenger-install-nginx-module by going to the directory at: /var/lib/gems/1.8/bin
Good luck!
I know you already answered the question, but figured I'd chime in with a cent or two.
I recently did a similar nginx install, but chose to go with RVM for managing Ruby versions, which requires us to NOT use sudo.
I recommend this route because all versions of Ruby and all your gems are organized neatly in your home directory. Doing so will also require you to compile nginx manually, which certainly helps understand the pipes a little.
You can compile nginx manually using the "--add-module=/home/user/path_to_passenger_gem/ext," but you'll want to read up RVM's instructions very carefully...really, don't skip a line as they are very concise.
Here's a link to RVM's instructions:
http://rvm.beginrescueend.com/passenger/
and to the Nginx manual instructions (which you probably already skimmed).
http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_phusion_passenger_for_nginx_manually
I have got a bit of information on my blog regarding setting up nginx with passenger (and ssl in this case). Perhaps it is of use since it goes through the whole process of recompiling nginx with options.

Local installation of ruby / rubygems with no root access

I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine.
So what I did was: Download ruby source, configure (with --prefix pointing to somewhere under my home dir), make, make install. Alright, ruby runs fine. Then I did the same with rubygems and installed it. Ok as well, untill I went to install my first gem.
I downloaded the gem package (sigh, lots of firewalls, can't just "gem install" something remote), net-ssh, and tried to install it locally. Got the infamous "no such file to load -- zlib". Clues about this led nowhere, so I tried the next approach: getting net-ssh's source. When it tries to require 'openssl' (or when I try it from irb), I get "no such file to load -- openssl".
All of these problems, apparently, could be solved by apt-getting or rpm installing, or whatever. Only problem is: I can't!
Any suggestions as to how I might proceed?
Thanks for the help,
Marcelo.
Closing this now.
I had to ask someone with root access to install zlib-devel and openssl-devel (I'm on RHEL). Couldn't make it otherwise.
I'm guessing there's probably a way of using the stuff inside said packages without installing them as root, but I couldn't do it.
Did you try Ruby RVM?
You can download, compile and install a full-featured Ruby version on your home environment.
I recently did the same. The trick that worked for me is NOT to use a --prefix flag when you install rubygems.

Resources