From: Ollivier Robert Date: 2003-04-23T22:19:37+09:00 Subject: DBI/OCI8 & binary data 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) or with /usr/lib/ruby/1.6/oci8.rb:239: `Not supported type (DBI::Binary)' (ArgumentError) The former is when I try to insert direct binary data stored in a string and the latter when I use DBI::Binary... Any idea? Code generating the second error: -=-=- matricule = argv[0].to_s path = LOGO_PATH + argv[1].to_s begin image_raw = File.open(path).read image = DBI::Binary.new(image_raw) rescue => msg $stderr.puts("Error: #{msg}") exit 1 end req = <<-"EOR" insert into prs_photo (mime_type, object) values (?,?) where c_matricule=? EOR begin $dbh.transaction do sth = $dbh.prepare(req) sth.bind_param(1, "image/jpeg") sth.bind_param(2, image, type => OCI8::RAW) sth.bind_param(3, matricule) sth.execute end rescue DBI::DatabaseError => err $stderr.puts "Error: #{err.err} #{err.errstr}" exit 1 end -=-=- -- Ollivier ROBERT -=- Eurocontrol EEC/AMI -=- roberto@eurocontrol.fr Usenet Canal Historique FreeBSD: The Power to Serve!