Connecting Ubuntu 14.04 with Rails 4.2 to MS SQL

Will clean this up, just jotting down as I go.

First, configure SQL so it allows mixed mode authentication. Create the appropriate development and test databases for your work. Create the appropriate user in Management Studio for your Ubuntu Rails server. As I'm using Vagrant, I just call mine vagrant. I give him SA rights and owner access to both databases.

You need to make sure you know your port. For SQL express using dynamic ports, it could be anything, so change that to a port you know.

On the Ubuntu 14.04 side run:

sudo apt-get -y install freetds-dev

Note: This is how to do it for 14.04. You don't need the -dev for other versions apparently.

Then install your gems. As I'm using Rails, based on instructions from https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds in to my gemfile:

gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'

I could also install the gems directly and probably will using:

gem install tiny_tds
gem install active-record-sqlserver-adapter

Now, Tiny_TDS doesn't work well with Ruby 2.2. So, you can downgrade your Ruby language, which I'd kill you if you did, or you have to install the tiny_tds gem in your gemfile as so: gem 'tiny_tds', git: 'https://github.com/rails-sqlserver/tiny_tds.git'

That will bundle from master and get you version 0.6.3 which fixes an error you'll get if you try it without. That error, BTW, is:

tiny_tds.so: undefined symbol: rb_thread_blocking_region
Back
paperclip paperclip