forked from rails-sqlserver/activerecord-sqlserver-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Platform Installation Windows
metaskills edited this page Sep 13, 2010
·
19 revisions
If you are finding that your column data (national varchar, text, decimal, etc) is coming back as binary or the data is truncated with “\000\000” or “\000”? The solution – when setting up your ODBC Datasource (DSN) in odbcad32.exe make sure that:
“Perform translation for character data” is OFF. “Use regional settings when outputting currency, numbers, dates and times” is OFF.Thanks to @adamdennis for this.
Before installing activerecord-sqlserver-adapter you have to install the ruby-odbc gem
But beware ! It needs a C – compiler for installation.
Either you have a ten year old Microsoft MSVC++ 6.0 Compiler
or better you may install the Ruby Development Kit first.
So step by step:
- Install devkit
- gem install ruby-odbc
- gem install activerecord-sqlserver-adapter
-
Maybe install
Microsoft SQL Server 2005 Native Client
Microsoft SQL Server 2008 Native Client - Create a ODBC Data Source
-
Modify database.yml
development:
adapter: sqlserver
database: MyDatabase
dsn: dsn_MyDatabase
mode: odbc
username: TestUser
password: xxxxx
encoding: utf8 -
Create an activemodel
class Customer < ActiveRecord::Base
set_table_name “dbo.Customer”
set_primary_key “CustomerID”
end -
Create an activecontroller
class CustomerController < ApplicationController
def index
@customers = Customer.find(:all, :conditions => [“CustName LIKE ‘Klaus%’”])
respond_to do |format|
format.html
end
end
end - StartRails: ruby script\server
and voilá : I get the error message : “failed to allocate memory”
ok, stay tuned I will do my best to find the failure cause
Update: the problem comes from a ntext column in my table …