1

Does anyone know of the best solution to connect to an old 2008 sql server? yeah, I know it’s old. i’ve been looking into sql-server-adapter gem, targeting 4.1.x but it’s not quite there. currently running rails 4.2.6 and ruby 2.2.5.

I've tried using activerecord-sqlserver-adapter 4.1.2 which I thought was the best option. We can connect just fine, but when attempting to get the first record, or any record for that matter, it doesn't return an active record object.

I've tried to loop it, but it says it can't get a [] of nil class. But if I YAML::dump(TheObject.first) it spits out a string with \n breaks with a record.

I feel like there's just something missing, even though I've followed tutorials and even just using the bare minimum necessary to connect.

It's the first time we've tried connecting to MSSQL with Rails so it's all rather new. Definitely nothing like connecting to Mongo or Postgres or even MySQL. lol.

Jason Shultz
  • 940
  • 1
  • 19
  • 36
  • Are you using the tiny_tds ( https://github.com/rails-sqlserver/tiny_tds ) with sqlserver-adapter? About 3 years ago I was on a Rails + SQL Server project, and that was the stable solution then. Maybe things have changed or it's something you already looked at, but thought I'd mention it – RyanWilcox Jun 07 '16 at 02:02
  • I am using tiny_tds in fact. i'm also using the activerecord-sqlserver-adapter gem. :/ – Jason Shultz Jun 07 '16 at 14:57

1 Answers1

0

Seems to be that the Stackoverflow consensus is "don't". There are two similar questions that kind of give an answer, but they both say it's not easy or straightforward.
This answer seems to be the most helpful: https://stackoverflow.com/a/5176511/275780
It references this question: Rails & MSSQL 2008 - Will We Hit Barriers? which advocates for jruby and basically says it's a pain.
This answer: https://stackoverflow.com/a/13518152/275780 actually seems to be helpful if you're going to go for it.

Community
  • 1
  • 1
xyious
  • 1,065
  • 4
  • 13
  • 29