Run SQL Server on your favorite platform Im choosing Linux - ubuntu
Start by going to the below page
By clicking Try now will take it to below url
choose Install on Ubuntu Linux 16.04 ->
follow the steps given below the “ Install SQL Server and create a database on Ubuntu “
Prerequisites
You must have a Ubuntu 16.04 machine with at least 3.25 GB of memory.
Same step listing here as well.
- Import the public repository GPG keys:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
2. Register the Microsoft SQL Server Ubuntu repository:
sudo add-apt-repository “$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
the4.After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
sudo apt-get update
sudo apt-get install -y mssql-server
a. Choose respective edition
b. Choose respective language
c. Set password
5. Once the configuration is done, verify that the service is running:
sudo /opt/mssql/bin/mssql-conf setup
At this point, SQL Server is running on your Ubuntu machine and is ready to use!
systemctl status mssql-server
At this point, SQL Server is running on your Ubuntu machine and is ready to use!
In rails application add list of gems into Gemfile and bundle it.
gem 'tiny_tds', '~>2.0.0'gem 'activerecord-sqlserver-adapter'
if fails and ask for
“ An error occurred while installing tiny_tds (2.0.0), and Bundler cannot continue. Make sure that `gem install tiny_tds -v ‘2.0.0’` succeeds before bundling.”
then do the listed below to solve the issue
sudo apt-get install wget
sudo apt-get install build-essential
sudo apt-get install libc6-dev
sudo wget http://www.freetds.org/files/stable/freetds-1.00.21.tar.gz
sudo tar -xzf freetds-1.00.21.tar.gz
cd freetds-1.00.21
sudo ./configure — prefix=/usr/local — with-tdsver=7.3
make
sudo make install
Few Reference link:
when you get error like below run the below command
/var/lib/gems/2.3.0/gems/tiny_tds-2.0.0/lib/tiny_tds.rb:41:in `require': libsybdb.so.5: cannot open shared object file: No such file or directory - /var/lib/gems/2.3.0/gems/tiny_tds-2.0.0/lib/tiny_tds/tiny_tds.so (LoadError)
from /var/lib/gems/2.3.0/gems/tiny_tds-2.0.0/lib/tiny_tds.rb:41:in `<top (required)>'
/sbin/ldconfig /usr/local/lib
Now setup the database.yml
default: &default
adapter: sqlserver
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
host: localhost
development:
<<: *defaultYes !!! you are done!!
database: rails_sample_development
username: sa
password: password given while setting up the mssql server
run rake db:create
start the rails server
Yes!! you are done
sudo apt-get install -y mssql-server
sudo apt-get install build-essential
sudo apt-get install libc6-dev
sudo wget http://www.freetds.org/files/stable/freetds-1.00.21.tar.gz
sudo tar -xzf freetds-1.00.21.tar.gz
cd freetds-1.00.21
sudo ./configure — prefix=/usr/local — with-tdsver=7.3
make
sudo make install