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.








Responses to “ubuntu under the rails how to connect sqlserver?”