1 Reply Latest reply on Sep 13, 2015 1:39 PM by shawkins

    Saving blob/varbinary to file from VDB.

    xyran

      Hi,

       

      I am have created a vdb using SQL Server source table as a source which stores content of file in varbinary.

       

      Does Red hat virtualization has any build in functions to query the VDB and save varbinary content to a file? Like SQL server's bcp or Oracle's  UTL_FILE.

       

      or

       

      Should I create a UDF like the following to save the varbinary content to file

       

      public static boolean savetoDisk(String filepath, Blob content){

       

      // body

      }

       

      Also on UDF, should all the functions need to have a return type? and how to handle any exception within UDF?

       

      Thanks in advance.

        • 1. Re: Saving blob/varbinary to file from VDB.
          shawkins

          > Does Red hat virtualization has any build in functions to query the VDB and save varbinary content to a file? Like SQL server's bcp or Oracle's  UTL_FILE.

           

          There is the file translator that exposes procedures for reading and writing files - File Translator - Teiid 8.12 (draft) - Project Documentation Editor

           

          > Also on UDF, should all the functions need to have a return type? and how to handle any exception within UDF?

           

          Yes it is expected that that UDFs are scalar / aggregate functions that return a value.  As for the exception handling, any exception thrown will get converted to a Teiid SQL exception.  If the exception thrown is a SQLException, then we'll propagate the error/vendor code.