<p>Does anybody here have positive experience of working with MS SQL Server 2005 from Rails 2.x?</p>

<p>Our developers use Mac OS X, and our production runs on Linux.   For legacy reasons we should use MS SQL Server 2005.</p>

<p>We're using ruby-odbc and are running into various problems, too depressing to list here. I get an impression that we're doing something wrong. </p>

<p>I'm talking about the no-compromise usage, that is, with migrations and all.</p>

<p>Thank you,</p>

[{'answer_id': 67962, 'author': 'Aupajo', 'author_id': 10407, 'author_profile': 'https://Stackoverflow.com/users/10407', 'pm_score': 1, 'selected': False, 'text': '<p>I would strongly suggest you weigh up migrating from the legacy database. You\'ll probably find yourself in a world of pain pretty quickly. From experience, Rails and legacy schemas don\'t go too well together either.</p>\n\n<p>I don\'t think there\'s a "nice solution" to this one, I\'m afraid.</p>\n'}, {'answer_id': 99768, 'author': 'hectorsq', 'author_id': 14755, 'author_profile': 'https://Stackoverflow.com/users/14755', 'pm_score': 2, 'selected': False, 'text': '<p>Instead of running your production server on Linux have you considered to run rails on Windows? I am currently developing an application using SQL Server and until know it seems to run fine.</p>\n\n<p>These are the steps to access a SQL Server database from a Rails 2.0 application running on Windows.</p>\n\n<p>The SQL Server adapter is not included by default in Rails 2. It is necessary to download and install it using the following command.</p>\n\n<pre><code>gem install activerecord-sqlserver-adapter\n--source=http://gems.rubyonrails.org\n</code></pre>\n\n<p>Download the latest version of ruby-dbi from</p>\n\n<p><a href="http://rubyforge.org/projects/ruby-dbi/" rel="nofollow noreferrer">http://rubyforge.org/projects/ruby-dbi/</a></p>\n\n<p>and then extract the file from ruby-dbi\\lib\\dbd\\ADO.rb</p>\n\n<p>to C:\\ruby\\lib\\ruby\\site_ruby\\1.8\\DBD\\ADO\\ADO.rb.</p>\n\n<p>Warning, the folder ADO does not exist, so you have to create it in advance.</p>\n\n<p>It is not possible to preconfigure rails for SQL Server using the --database option, just create your application as usual and then modify config\\database.yml in your application folder as follows:</p>\n\n<pre><code>development:\nadapter: sqlserver\ndatabase: your_database_name\nhost: your_sqlserver_host\nusername: your_sqlserver_user\npassword: your_sqlserver_password\n</code></pre>\n\n<p>Run rake db:migrate to check your installation. If everything is fine you should not receive any error message.</p>\n'}, {'answer_id': 185827, 'author': 'Benjamin Atkin', 'author_id': 3461, 'author_profile': 'https://Stackoverflow.com/users/3461', 'pm_score': 3, 'selected': False, 'text': '<p>Have you considered using JRuby? Microsoft has a <a href="http://msdn.microsoft.com/en-us/data/aa937724.aspx" rel="nofollow noreferrer">JDBC driver for SQL Server</a> that can be run on UNIX variants (it\'s pure Java AFAIK). I was able to get the 2.0 technology preview working with JRuby and Rails 2.1 today. I haven\'t tried migrations yet, but so far the driver seems to be working quite well.</p>\n\n<p>Here\'s a rough sketch of how to get it working:</p>\n\n<ol>\n<li>Make sure Java 6 is installed</li>\n<li>Install JRuby using the instructions on the <a href="http://www.jruby.org/" rel="nofollow noreferrer">JRuby website</a></li>\n<li>Install Rails using gem (<code>jruby -S gem install rails</code>)</li>\n<li>Download the UNIX package of <a href="http://msdn.microsoft.com/en-us/data/aa937724.aspx" rel="nofollow noreferrer">Microsoft\'s SQL Server JDBC driver</a> (Version 2.0)</li>\n<li>Unpack Microsoft\'s SQL Server driver</li>\n<li>Find sqljdbc4.jar and copy it to JRuby\'s lib directory</li>\n<li><code>jruby -S gem install activerecord-jdbcmssql-adapter</code></li>\n<li>Create a rails project (<code>jruby -S rails hello</code>)</li>\n<li>Put the proper settings in database.yml (example below)</li>\n<li>You\'re all set! Try running <code>jruby script/console</code> and creating a model.</li>\n</ol>\n\n<pre>\n    development:\n      host: localhost\n      adapter: jdbc\n      username: sa\n      password: kitteh\n      driver: com.microsoft.sqlserver.jdbc.SQLServerDriver\n      url: jdbc:sqlserver://localhost;databaseName=mydb\n      timeout: 5000\n</pre>\n\n<p>Note: I\'m not sure you can use Windows Authentication with the JDBC driver. You may need to use SQL Server Authentication.</p>\n\n<p>Best of luck to you!</p>\n\n<p>Ben</p>\n'}, {'answer_id': 759589, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': "<blockquote>\n  <p>Our developers use Mac OS X, and our production runs on Linux. For legacy reasons we should use MS SQL Server 2005.</p>\n</blockquote>\n\n<p>We are developing on Ubuntu 8.04, but our production servers are running Linux (Centos) and we are also using SqlServer 2005. </p>\n\n<p>From our experiences the initial setup and config was quite painful - it took a couple of weeks to get everything to play nicely together. However, it's all seemless now, and I find SqlServer works perfectly well.</p>\n\n<p>We use the FreeTDS ODBC drivers which once configured are fine.</p>\n\n<p>DO NOT run productions Rails apps on Windows - you're asking for trouble. It's fine for development but nothing more. Rails doesn't scale well on Windows platforms.</p>\n\n<p>Hope that helps.</p>\n"}]
['https://Stackoverflow.com/questions/67141', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7754/']