Sean.O''Halpin-8sXrNCV1arxBDgjK7y7TUQ@public.gmane.org
2004-Nov-15 15:43 UTC
MSSQL connection adapter
Hi - I''ve knocked together a rough and ready adapter for MS SQL which you can find at http://www.ohalpin.com/downloads/mssql_adapter.rb. It overrides some ActiveRecord::Base methods so I doubt if you''d be able to use it at the same time as a MySQL connection (I haven''t tried though). It uses DBI::ODBC under the hood so you need that installed too. I haven''t unit tested it yet so I have no idea how many tests it passes or rails. It works fine for my requirements. YMMV. To ''install'' it, copy it into your rails app''s lib directory and require it in configuration\environments\shared.rb just after all the other requires. (If anyone has a better approach, please let me know.) Here''s an example database.yml: production: adapter: mssql database: Scratch host: DBI:ODBC:Driver={SQL Server};Server=SEAN_OLAP;Database=Scratch;Uid=your_username;Pwd=your_password username: your_username password: your_password test: adapter: mssql database: Scratch host: DBI:ODBC:Driver={SQL Server};Server=SEAN_OLAP;Database=Scratch;Uid=your_username;Pwd=your_password username: your_username password: your_password I''m certainly interested in feedback but I can''t give any guarantees as to fixing things in a hurry. Regards, Sean O''Halpin ********************************************************************** Aegis Media, Parker Tower, 43-49 Parker Street, London, WC2B 5PS. Telephone: 020 7430 6300 Facsimile: 020 7430 6319 www.aemedia.com This e-mail contains information which is confidential and which may be legally privileged and protected from disclosure. If you are not the intended recipient of this e-mail or any parts of it, please telephone us immediately on receipt. You should not disclose the contents to any other person, nor take any copies. ********************************************************************** _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> Hi - I''ve knocked together a rough and ready adapter for MS SQL which > you > can find at http://www.ohalpin.com/downloads/mssql_adapter.rb.Looks cool. I have another guy working on one in ADO. It''ll be interesting to evaluate the differences. I''ll get back to you when I have a few minutes to get this in. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain