Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
CREATE TABLE MEDIA
(
   MEDIAID NUMBER(22) NOT NULL,
   BINARYDATA BLOB NOT NULL
);

CREATE   SEQUENCE   SEQ_MEDIAID
INCREMENT   BY   1
START   WITH   100
ORDER;


.  Copying a file to Blob!

Code Block

    ...
    // write the array of binary data to a BLOB
    outstream = my_blob.getBinaryOutputStream();
  
    def fis= new FileInputStream('c:\\Jornada\\auxil\\010306_115332.jpg')
    println "File size= ${fis.available()}"
    byte[] data = new byte[fis.available()]
    fis.read(data)
    fis.close()
    
    outstream.write(data);
    outstream.close()
    
    sql.commit()
    ...