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.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of ubuntu under the rails how to connect sqlserver?

  • Rails2.0.2 change the default DB adpter

    In Rails2.0.2 rails demo ... ... MissingSourceFile in SayController # hello no such file to load - sqlite3 RAILS_ROOT: / home / kenb / rails-projects / demo ... ... Checked config / database.yml, adpter default is set become the sqlite3. Check the ra ...

  • RSpec troubleshooting

    1.uninitialized constant Dependencies Conditions: In windows under way to install the RSpec gem and rspec-rails. However, in ruby script / spec_server to do the test under the spec your_spec.rb-X will appear uninitialized constant Dependencies (NameE ...

  • Alternative to Java with Ruby to do unit testing interface rest!

    Ruby is long overdue to replace java more flexible and make some necessary changes in a matter of, if not deep-rooted culture of the company's java, I think. . . . . . The following are my Writing for the Rest of the interface used to make the test su

  • Answer: After 2.2 upgrade mysql question-driven

    windows installed after the mysql gem error, error is approximately: ArgumentError (NULL pointer given): (eval): 3: in `each_hash ' (eval): 3: in `all_hashes' This is feeling under the windows of the question if the mysql gem version libmysql ...

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • Struts2 Spring Hibernate integration of easy

    1. Add Spring 2.0 in Libraries Choose the following four jar, and configure the / WEB-INF/lib under Spring2.0 AOP Libraries Spring2.0 Core Libraries Spring2.0 Persistence Core Libraries Spring2.0 WEb Libraries At the same time, the applicationContext ...

  • EJB ant script to deploy template works

    <? xml version = "1.0" encoding = "UTF-8"?> <! - Name Project name basedir build.xml file directory -> <project name="HelloWorld" basedir="."> <! - Property variables -> <! - The sour ...

  • Struts2 Spring Hibernate's easy to integrate

    1. Add Spring 2.0 in Libraries Choose the following four jar, and configure the / WEB-INF/lib under Spring2.0 AOP Libraries Spring2.0 Core Libraries Spring2.0 Persistence Core Libraries Spring2.0 WEb Libraries At the same time, the applicationContext ...

  • Oracle instant clent for ruby / rails on cygwin

    Environment: XP: oracle full client, ruby, rails, gem cygwin: ruby rails, gem (the version with the XP version) Needs: for cygwin is installed under the rails platform support oci Steps: <1> download oracle instant client (10.2.0.3 Instant Clie ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries