On May 24, 8:06 pm, ct9a [email protected] wrote:
guys,
It’s interesting. Did the post below solve the problem?
Not for me. I am still working on getting the connection working,
although I have not spent too much time on it. I am using SQL Server
2005, though, and I know pretty much nothing about SQL Server so it’s
being a little bit of a learning curve to set this up.
So far I have installed DBI and activerecord-sqlserver-adapter
(2.3.5). After I did that I tried to use mode ADO and got this:
NotImplementedError: Please use version 2.3.1 of the adapter for ADO
connections. Future versions may support ADO.NET.
So I installed 2.3.1 instead and got this when starting the console
(but it let me in):
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/
connection_adapters/abstract/connection_specification.rb:76:in
establish_connection':RuntimeError: Please install the sqlserver adapter:
gem install activerecord-sqlserver-adapter` (no such file to
load – deprecated)
and this when trying to instantiate a new record for a table:
ActiveRecord::ConnectionNotEstablished:
ActiveRecord::ConnectionNotEstablished from c:/ruby/lib/ruby/gems/1.8/
gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/
connection_pool.rb:326:in `retrieve_connection’
Seeing this amount of “success” I switched back to 2.3.5 and changed
the mode to ODBC, but the DSN parameter gave me trouble. Now I think
the DSN is OK (not sure, though):
dsn: Driver={SQL Server};Server=<server_name>
where <server_name> is the server name showing in the Connection
Properties window off the DB Management application (Microsoft SQL
Server Management Studio Express).
I think the DSN is OK because of the error I am getting now, which
could indicate that I have passed the DSN problem but there is
something else going on. Now starting the console gives no errors but
I can’t get to the tables (testing from the console with a ‘Table.new’
command):
ODBC::Error: S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string
or buffer length
I have checked on error S1090 and this is what I found:
SQLExecute
S1090
Invalid string or buffer length. One of the following
situations:
* Parameter pointer is null and length does not equal
SQL_NULL_DATA.
* Parameter is not null and length is equal to
SQL_NULL_DATA.
* Parameter is not null, length is negative, length is not
equal to SQL_NULL_DATA, and length is not equal to SQL_NTS.
I seems to me like some type of “configuration” error. If anybody has
an idea of what could be going on I would appreciate any help and if I
get a connection working I’ll make sure I post here the steps it took
me to make it work.