Receiving error when connecting to table with BLOBs

27 views
Skip to first unread message

Michael Sexton

unread,
Jul 30, 2010, 1:37:11 AM7/30/10
to Oracle enhanced adapter for ActiveRecord
This is the error I get.

RuntimeError: unsupported typecode blob: SELECT * FROM blobtable WHERE
(blobtable.blobno = 48)

And the full trace below:

./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract_adapter.rb:219:in `rescue
in log'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract_adapter.rb:202:in `log'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-oracle_enhanced-
adapter-1.2.3/lib/active_record/connection_adapters/
oracle_enhanced_adapter.rb:1359:in `log'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-oracle_enhanced-
adapter-1.2.3/lib/active_record/connection_adapters/
oracle_enhanced_adapter.rb:1283:in `select'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract/query_cache.rb:60:in `block
in select_all_with_query_cache'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract/query_cache.rb:81:in
`cache_sql'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all_with_query_cache'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/base.rb:661:in `find_by_sql'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/base.rb:1548:in `find_every'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/base.rb:1583:in `find_one'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/base.rb:1569:in `find_from_ids'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/base.rb:616:in `find'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/associations/belongs_to_association.rb:49:in
`find_target'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/associations/association_proxy.rb:239:in `load_target'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/associations/association_proxy.rb:112:in `reload'
./ruby/linux/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/
active_record/associations.rb:1250:in `block in
association_accessor_methods'

I'm using ActiveRecord 2.3.5 and Oracle Enhanced Adapter 1.2.3

Running on 64 bit Linux with Oracle 10g.

Not sure what I am doing wrong - a simple connection.execute seems to
work. Any help would be appreciated, thanks.

Raimonds Simanovskis

unread,
Aug 2, 2010, 4:55:22 PM8/2/10
to Oracle enhanced adapter for ActiveRecord
This error message comes from ruby-oci8. Which ruby-oci8 gem version
are you using?

And can you show the structure of your blobtable table? (DESC
blobtable)

And also I see that you use oracle_enhanced adapter version 1.2.3 - it
would be better to upgrade to 1.2.4 or 1.3.0.
And also I see that you use Ruby 1.9.1 which is not fully supported
with Rails 2.3.5 - it would be safer to use Ruby 1.8.7

Raimonds

Michael Sexton

unread,
Aug 9, 2010, 9:44:08 PM8/9/10
to oracle-...@googlegroups.com
Raimonds,

I've upgraded to oracle_enhanced adapter version 1.3.0. I'm using ruby-oci8-2.0.4. I'm using Ruby 1.9.1 because 1.8.7 had trouble compiling 1.8.7 on my 64 bit machine (can't remember why at this stage). I'll investigate as to whether I can revert to the supported version.

DESC blobtable taken from iSQl*Plus (sorry about formatting)

Name Null? Type
BLOBNO NOT NULL NUMBER(38)
NAME NOT NULL VARCHAR2(4000)
BLOBTYPE   VARCHAR2(20)
DESCRIPTION   VARCHAR2(4000)
LOCALDATA   BLOB
SRCTYPE   VARCHAR2(4000)
SRCLOCATION   VARCHAR2(4000)
SRCNAME   VARCHAR2(4000)
UPDATETIME   DATE
LOCAL   NUMBER(38)
FORMAT   VARCHAR2(30)
MIMETYPE   VARCHAR2(4000)
COMMENTS   CLOB
ENCODING   VARCHAR2(256)
NUMBEROFCHANNELS   NUMBER(38)
SAMPLINGRATE   NUMBER(38)
SAMPLESIZE   NUMBER(38)
COMPRESSIONTYPE   VARCHAR2(4000)
AUDIODURATION   NUMBER(38)
HEIGHT   NUMBER(38)
WIDTH   NUMBER(38)
CONTENTLENGTH   NUMBER(38)
FILEFORMAT   VARCHAR2(4000)
CONTENTFORMAT   VARCHAR2(4000)
COMPRESSIONFORMAT   VARCHAR2(4000)
FRAMERESOLUTION   NUMBER(38)
FRAMERATE   NUMBER(38)
VIDEODURATION   NUMBER(38)
NUMBEROFFRAMES   NUMBER(38)
NUMBEROFCOLORS   NUMBER(38)
BITRATE   NUMBER(38)
COPYRIGHT   VARCHAR2(255)
COPYRIGHTCONTACT   VARCHAR2(255)
CREATOR   VARCHAR2(255)
ORIGINDATE   DATE
KEYWORDS   VARCHAR2(4000)
ACCESS_CODE NOT NULL VARCHAR2(1)
ANO NOT NULL NUMBER(10)
ENTRYDATE   DATE
ENTEREDBY   VARCHAR2(30)
LASTUPDATE   DATE
UPDATEDBY   VARCHAR2(30)
QADATE   DATE
QABY   VARCHAR2(30)
QA_STATUS_CODE NOT NULL VARCHAR2(1)
ACTIVITY_CODE NOT NULL VARCHAR2(1)
CAPTION   VARCHAR2(4000)
THUMBNAIL   ORDSYS.ORDIMAGE
REMARK   VARCHAR2(4000)






--
You received this message because you are subscribed to the Google Groups "Oracle enhanced adapter for ActiveRecord" group.
To post to this group, send email to oracle-...@googlegroups.com.
To unsubscribe from this group, send email to oracle-enhanc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/oracle-enhanced?hl=en.


Raimonds Simanovskis

unread,
Aug 10, 2010, 12:01:01 PM8/10/10
to Oracle enhanced adapter for ActiveRecord
It seems that the issue is with the column
THUMBNAIL ORDSYS.ORDIMAGE

oracle_enhanced currently does not support custom data types defined
in database. One workaround is to define view on this table that will
not include this column.
Can you verify that this is the issue?

Raimonds
> > oracle-enhanc...@googlegroups.com<oracle-enhanced%2Bunsubscribe@ googlegroups.com>
> > .

Michael Sexton

unread,
Aug 10, 2010, 11:10:50 PM8/10/10
to oracle-...@googlegroups.com
Raimonds,

I was thinking the same, but unfortunately I don't have the correct roles to make views in our DB. I've tried ignore_table_columns, but that hasn't seemed to work. Is there another 'hide' available for this troublesome column?

I'm a bit of a novice here, but from what I understand is that ruby-oci8 has object type support - in fact I already use this for our geometry columns that use MDSYS.SDO_GEOMETRY. ORDSYS.ORDIMAGE is a similar object type - part of Oracle's Intermedia package.

I am guessing that there is no blob attribute specified in the code at the link below (say something like, ATTR_BLOB).


Therefore, I would suppose the only fix for this is to add blob attribute support for object types that Oracle uses.

So as you said at the beginning, this isn't an oracle_enhanced-adapter problem, but a ruby-oci8 one. I'll see if I can pose the question there.

Thanks

Michael

To unsubscribe from this group, send email to oracle-enhanc...@googlegroups.com.

Michael Sexton

unread,
Aug 11, 2010, 12:49:14 AM8/11/10
to Oracle enhanced adapter for ActiveRecord
What I am finding especially frustrating is that if I type:
Blob.find(48).name into the rails console I get back data, but if I do
it through Rails itself, I get the error in the first email!

On Aug 11, 1:10 pm, Michael Sexton <mick.sex...@gmail.com> wrote:
> Raimonds,
>

Raimonds Simanovskis

unread,
Aug 11, 2010, 4:17:35 PM8/11/10
to Oracle enhanced adapter for ActiveRecord
Just verified that the issue is in ruby-oci8 and posted sample code
how to repeat it in ruby-oci8 discussion group:

http://rubyforge.org/forum/message.php?msg_id=94511

Raimonds
Reply all
Reply to author
Forward
0 new messages