CodeWeblog.com » ruby,lib,192 » ubuntu under the rails how to connect sqlserver?

ubuntu under the rails how to connect sqlserver?

Rails to connect SQL SERVER is a more complicated matter. Since different platforms are different methods of treatment.

Take linux for a different release version has a different treatment methods.

Record ubuntu here under the rails to connect sqlserver steps.
Reference: http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux

1 Edit ~ /. Bashrc file, add:

export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
export FREETDSCONF=/etc/freetds/freetds.conf


2 install unixODBC

sudo apt-get install unixodbc unixodbc-dev tdsodbc


3 installed FreeTDS

sudo apt-get install freetds-dev sqsh


Configure FreeTDS: Edit / etc / freetds / freetds.conf, add:

[YOUR_DB_DEFINITION_NAME]
host = 192.168.1.101 (change this to the right one for you)
port = 1433
tds version = 8.0



Test FreeTDS:

sqsh -S YOUR_DB_DEFINITION_NAME -U USERNAME -P PASSWORD


4 the definition of DB
Edit / etc / odbc.ini:

[YOUR_DB_DEFINITION_NAME]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = YOUR_DB_DEFINITION_NAME
Database = YOUR_ACTUAL_DB_NAME


Edit / etc / odbcinst.ini:

[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1


Test:

isql YOUR_DB_DEFINITION_NAME USERNAME PASSWORD


RUBY ODBC installation 5

sudo apt-get install libodbc-ruby1.8


6 installed RBI ODBC DRIVER

sudo gem install activerecord-odbc-adapter


The end of this installation.

databse.yml in this definition:

development:
adapter: odbc
dsn: YOUR_DB_DEFINITION_NAME
username: USERNAME
password: PASSWORD



The above steps at ubuntu8.04, ruby1.8.6, rails 2.1, under the test.
Digg Technorati StumbleUpon Mixx del.icio.us Reddit BlinkList Furl YahooMyWeb feedburner

Tags: ruby (RSS), lib (RSS), 192 (RSS), yml (RSS), linux (RSS), rubyonrails (RSS), odbc installation (RSS), driver usr (RSS), port 1433 (RSS), odbc dsn (RSS), db name (RSS), ms sql (RSS), sqsh (RSS), tds (RSS), unixodbc (RSS), platforms (RSS)

Permalink: http://www.codeweblog.com/ubuntu-under-the-rails-how-to-connect-sqlserver/

1 comments to “ubuntu under the rails how to connect sqlserver?”

  1. VetaAlebrabor on 2009-09-28 16:34:59 :
    Hello! Base klooper for my english jer, buti very nice re say gJ$)Kd!!!.

Leave a reply