From: KUBO Takehiro Date: 2003-04-24T00:14:17+09:00 Subject: Re: DBI/OCI8 & binary data Hi, Ollivier Robert writes: > Env.: ruby 1.6.8, ruby-dbi 0.18, ruby-oci8 0.1.2. > Oracle 9.2.0.1.0, Red-hat 7.2. > > I'm trying to insert binary data into a BLOB field and it always with > either > > /usr/lib/ruby/1.6/oci8.rb:300: `ORA-00933: SQL command not properly ended' (OCIError) (snip) > image_raw = File.open(path).read > image = DBI::Binary.new(image_raw) I re-read my codes. I forgot many of them. :-) DBI::Binary is not support by DBD::OCI8. Please use binary data stored in a string. > req = <<-"EOR" > insert into prs_photo (mime_type, object) values (?,?) > where c_matricule=? > EOR Do you want to do 'update' or 'insert'? If you want to do 'update': update prs_photo set mime_type = ?, object = ? where c_matricule = ? If you want to do 'insert': insert into prs_photo (mime_type, object, c_matricule) values (?,?,?) 'insert' with 'where' clause is not allowed. > sth.bind_param(2, image, type => OCI8::RAW) Please change to sth.bind_param(2, image, type => DBI::SQL_BINARY) But I have not tested your code and my modified code yet. :-< I've just read and thought. I'll test them on next weekend. Cheers. -- KUBO Takehiro kubo@jiubao.org