Created
June 15, 2014 09:36
-
-
Save rubypanther/670081512f45b4a285f6 to your computer and use it in GitHub Desktop.
MS Sql Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'bundler/setup' | |
Bundler.require(:db) | |
ActiveRecord::Base.establish_connection YAML.load_file( File.join(File.dirname(__FILE__),'..','config','database.yml'))[environment] | |
$: << File.join(File.dirname(__FILE__),'..','app','models' ) | |
# do work here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
adapter: sqlserver | |
mode: odbc | |
dsn: blah-blah-blah | |
username: blahblah | |
password: blahblah | |
encoding: utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :db do | |
gem 'ruby-odbc', :require => 'odbc' | |
gem 'tiny_tds' | |
gem 'activerecord-sqlserver-adapter', '~> 3.1.0' | |
end | |
group :development do | |
gem 'rails' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[blah-blah-blah] | |
Description = This is the dsn you cite from database.yml | |
Driver = ms-sql | |
Servername = WINDOWSNETWORKNAMEOFSERVER | |
UID = Home | |
Port = 1433 | |
Database = the_real_db_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment