views:

98

answers:

1

I'm using the activerecord-jdbc-adapter with ActiveRecord to be able to access a SQLServer database for Rails Application running under jRuby and am having trouble inserting binary data. The Exception I am getting is below. Note I just have a blurb for the binary data from the fixtures that was working fine for MySQL.

ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError: Operand type clash: nvarchar is incompatible with image: 
INSERT INTO blobstorage_datachunks ([id], [datafile_id], [chunk_number], [data]) VALUES (369397133, 663419003, 0, N'GIF89a@')

When I created the tables the migration had binary and SQLServer used Image instead. We're using Rails 2.3.5, SQLServer Express 2008. What I'm looking for is a way to get the binary data into SQLServer with ActiveRecord.

Thanks in advance for the help.

A: 

are you using the rails-sqlserver-adapter (Github), there's some documentation about Native Text/String/Binary Data Type Accessors.

Patrick Klingemann
Thanks Patrick, I'll give that a shot. Any idea if it will work under JRuby?
John Duff