0

Since none of the tools I have handy on my Windows laptop can export decent CSV files from SQL Server to save their lives, I figured I'd roll my own in a few lines of Ruby.

Because I'm hitting the version of SQL Server from the turn of the century, I have to use an old version of activerecord-sqlserver-adapter. As far as I can tell I'm doing this correctly, and should be using activerecord ~> 2.2.3 and the 2-3-stable branch of activerecord-sqlserver-adapter, but I am getting an error that complains it is Unable to activate activerecord-sqlserver-adapter-3.2.12, because activerecord-2.2.3 conflicts with activerecord (~> 3.2.0). Here's my code (without anything specifically related to CSVs):

#!/usr/bin/env ruby

gem 'activerecord', "~> 2.2.3"
gem 'activerecord-sqlserver-adapter', github: 'arthrex/activerecord-sqlserver-adapter', :branch => '2-3-stable'

require 'activerecord'
require 'activerecord-sqlserver-adapter'
require 'pry'

ActiveRecord::Base.establish_connection(
  :adapter => "sqlserver",
  :mode => "odbc",
  :username => "c3",
  :password => "92641",
  :dsn => "Connect3"
)
ActiveRecord::Base.table_name_prefix = 'dbo.'

class Dwnld_Hdr < ActiveRecord::Base
end

pry

Why is it trying to load activerecord (~> 3.2.0) in the first place?

iconoclast
  • 21,213
  • 15
  • 102
  • 138

1 Answers1

1

I think in this case you might probably use bundler, because then it will allow you to run the specific gem sets.

Read here and here to get an idea on how to use bundler in a non-Rails project.

halfer
  • 19,824
  • 17
  • 99
  • 186
sameera207
  • 16,547
  • 19
  • 87
  • 152
  • I actually tried that first, and [it didn't work](http://stackoverflow.com/q/20688914/241142). I was hoping this approach would be easier than overcoming [the problem I ran into on the normal Gemfile approach](http://stackoverflow.com/q/20688914/241142). Of course it's quite possibly having the same problem, but burying it just a little deeper. – iconoclast Dec 19 '13 at 18:24