Plesae help- needing to read a blob from db into bytes[]

Hi all,
I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
The code under page 1 is as follows:
DECLARE
z number;
y varchar2(4000);
x varchar2(400);
b blob;
BEGIN
select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
select length(convertBlobToBytes(b)) into z from dual;
:P1_RESULT := z;
end;
Java code is as follows:
import java.io.*;
import java.sql.Blob;
public class convertBlob {
* @param blob
* @return
public static byte[] convertBlobToBytes(Blob blob) {
     if (blob==null) return null;
     try {
     InputStream in = blob.getBinaryStream();
     int len = (int) blob.length(); //read as long     
long pos = 1; //indexing starts from 1
     byte[] bytes = blob.getBytes(pos, len);           
in.close();
     return bytes;     
catch (Exception e) {
     System.out.println(e.getMessage());
     return null;
PL/SQL wrapper is as follows:
CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
But I am getting the length of the file, as twice the size.
For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
And hence I am getting wrong results, further in the process.
Can you please help me? Any help is appreciated.
rgds,
Suma.

Hi all,
Can any of you please help me out?
rgds,
Suma.

Similar Messages

  • Need help- need to read a customer table from the payroll schema

    Hi gurus,
    I need to read an amonunt from a customer table in the payroll schema. Is it possible to input TABLE XXXX in the schema, or is impossible to read from a customer table?Do I need to create a report to upload the amount in an infotype?
    Thanks in advanced for for support!

    You should create your own custom operation (based on operation TABLE) to read your custom table from a Payroll PCR.
    If your custom table's name is longer than 5 characters, you may be required to use operations VAOFF and/or VALEN prior to your custom operation in the PCR.

  • Help needed in Connecting to SAP From Eclipse

    Hi All,
    Currently, we have a requirement where we need to retrieve data from SAP System and need to upload the same in a Third Party Application (Java based system).
    We are able to create an account in Java Application using Eclipse IDE by hard coding the Account details. We are stuck up in establishing the SAP connection and retrieving the details and then creating the extracted account details in Java application from Eclipse.
    Any pointers on this will be of great help.
    Regards,
    Eureka

    Hi Eureka,
    Please refrain from creating cross-posts in parallel forums, moreover this question is JCo-related and is not directly connected with Java EE 5. The Help needed in Connecting to SAP From Eclipse in the Java Programming forum would be enough. Please continue the discussion there.
    Regards,
    Vladimir

  • Need help with EXS24 "read velocity range from file name"

    I am trying to import 127 drum samples to a single key using the option shown here. The option says "Map to key dropped on and read velocity range from file name". I can find no documentation in the manuals on how to do this. What is the syntax required in the file name to make this work? I need to do several of these imports. The capability is cleary there, but I need help on how the file name should be formatted. My thanks to anyone who can help.

    Hi
    Not a direct answer to your question, but if you are doing a lot of sample mapping etc, you may want to check out Redmatica's KeyMap Pro or the simpler Keymap 1:
    http://www.redmatica.com
    CCT

  • Urgent help needed with reading data from Cube

    Hi Gurus,
    Can anyone tell me how to read a value from a record in the CUBE with a key (combination of fields).
    Please provide if you have any custome Function Module or piece of code.
    Any ideas are highly appreciated.
    Thanks,
    Regards,
    aarthi

    Due to the nature of the cube design, that would be difficult, that's why there are API's, FMs, and MDX capabilities - to eliminate the need to navigate the physical structure.  Otherwise you would have to concern yourself with:
    - that there are two fact tables E and F that would need to be read.  The Factview could take of this one.
    - you would want to be able to read aggregates if they were available.
    - the fact table only as DIM IDs or SIDs (for line item dims) to identify the data, not characteristic values.  A Dim ID represents a specific combination of characteristic values.

  • Help needed in reading data from a Crystal Report

    I am trying to read data values from a saved crystal report. (groovy code snippet below)
    I open a new ReportClientDocument and set the RAS using the inprocConnectionString property.
    Then I get the rowsetController and set defaultNumOfBrowsingRecords, rowsetBatchSize and maxNumOfRecords all to 1000000
    Using the browseFieldValues method after that returns only 100 records. I want to get all.
               ReportClientDocument clientDocSaved;
           def pathout=rc.pathToSavedReports+rr.path;
         //****** BEGIN OPEN SAVED SNAPSHOT ************
         clientDocSaved = new ReportClientDocument();
         clientDocSaved.setReportAppServer(ReportClientDocument.inprocConnectionString);       
            // Open report
         println("Reading file in.")
         clientDocSaved.open(pathout, OpenReportOptions._openAsReadOnly);
           def rowsetController = clientDocSaved.getRowsetController()
         rowsetController.setDefaultNumOfBrowsingRecords(1000000)
         rowsetController.setRowsetBatchSize(1000000)
         rowsetController.setMaxNumOfRecords(1000000)
         //setup metadata
         IRowsetMetaData rowsetMetaData = new RowsetMetaData()
         Fields fields =  clientDocSaved.getDataDefController().getDataDefinition().getResultFields()
         rowsetMetaData.setDataFields(fields)
         def values = rowsetController.browseFieldValues(fields.get(0), 1000000)
         values.each{value->
            println(value.displayText(new Locale("ENGLISH")))
    Before using the browseFieldValues method I was trying to use a rowsetCursor
                //get the rowset cursor to navigate through the results
                RowsetCursor rowsetCursor = clientDoc.getRowsetController().createCursor(null, rowsetMetaData)
                //navigate through the rowset and log the name and value
                rowsetCursor.moveTo(0)
                while(!rowsetCursor.isEOF()){
                     Record currentRecord = rowsetCursor.getCurrentRecord()
                     //println("current record number: " + rowsetCursor.getCurrentRecordNumber())
                     for(int i=0;i<fields.size();i++){
                          //println("Column - "+fields.get(i).getName())
                          if (currentRecord.size()>0){
                              println(currentRecord.getValue(i))
                     rowsetCursor.moveNext()
    the currentRecord was always an empty list and I did not get any data values at all.
    Am I missing something in using these approaches?
    I'm fairly new to using the Java SDK for CR. Any help will be greatly appreciated.
    Thanks

    hi, I am trying this second method to read the values from report. but all the records comming as null. Kindly help me to resolve this issue.

  • HELP HELP REQUIRED!!!!!! Reading and Writing  from and into a Telnet Window

    Hi,
    I need to read and write into a Telnet window .But the Telnet window is a exe program that is been given by the Windows while installing the OS. Another thing is that I need to read and write into/from the Telnet window at a specific X and Y positions which will be defined in the database . I did searched for a dll of Telnet which can contain some APIs to achieve the task but I was unable to fine one.
    Even if u wont be able to provide me the perfect solution , Please guide me how to read and write from a executable window .
    Any help will be highly appreciated.
    Thanking in Advance.
    Mannu26.

    Hi Guys ,
    Thanks for the comments , atleast I got few but none were of any use to me. If u can Please help me on this topic it will be very kind of you .
    Take Care.
    Manoj.

  • Help required in reading a file from Shared location on Network

    Hi,
    I need help in reading a file from a shared location. Can you kindly tell me the pattern for inputting the shared location path. I am using fileUtilService>Exists
    "\\Shiva\test\shared\eForms\temp.xlsx" is the actual location of the file. How should i input the location in the INPUT variable of EXISTS.

    readResource content operation will fetch documents from Adobe Repository. Unless you checkin the required file into repository, the above error will remain.
    From a shared folder, you should able to read the files using readDocument (using FileUtils) without any issues. Perhaps, the access rights prevent the execution.
    If you are running JBoss as a windows service (turnkey will create a windows service for the JBoss instance), try the following:
    Run -> services.msc -> Right click on JBoss service for Adobe LiveCycle -> Properties
    Check the value given under logon tab. The User Account mentioned there should have appropriate access to the shared folder you are attempting read.
    Nith

  • Help needed with Reader Integrated Key

    Hi,
    I have develop a plug-in and apply for Reader Integrated Key License. This plug-in have been tested with acrobat and reader professional and it is working.
    I follow the advice from the above website and use RIKLATools.zip to created the pair.
    i have just receive the Reader Integrated Key from Adobe,I tried all method but the key  does not work with the plug-in. What is the fool proof way to integrate my Reader Integrated Key with the plug-in to get a digtally signed plug-in?
    Urgent help needed as we are submitting the plug-in to client.
    many Thanks in advance
    Regards
    Jia hao

    Thank you lrosenth, i will email them

  • URGENT HELP NEEDED: counting number of particles from image

    this image on the left is showing particles
    hello i want to create a small VI that can count number of particles from a image that i load up. please see the attached image of particles and the VI printshot.
    I have used the tutorial "counting number of particles" but still the above VI does not work. it shows the number of particles = 1.. I do not know why it is doing so??
    I am not an expert in Labview so please can someone tell me where the problem is. sorry i could not attach the VI file itself but i have given an image of it..
    after anyone has solved this problem, i have to create a live system that will get live images from the camera - four frames every sec and the above VI has to count the
    number of particles for each frame and output to the user?? is this possible can anyone do it for me???
    p.s. in the above VI i read the image from file and count the number of particles. i do not do it to the binary image becuase the binary image is only a black screen
    when i run it
    thankyou

    Hi Farhan,
    Vision Assistant would be the best option to create some steps which you can then export to LabVIEW. You should try using the IMAQ Find Circles.vi. The attached image helps you find the number of circles of an image acquired from a camera. I have used the IMAQdx VIs in this example.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    vision.vi ‏59 KB

  • Help needed in understanding conversion alghorithm from byte to hex

    Hi, I'm studying the following code:
    public static char[] byteToHex(byte[] data) {
      char[] retValue = new char[data.length * 2];
      int value = 0;
      int highIndex = 0;
      int lowIndex = 0;
      for (int i = 0; i < retValue.length; i++) {
        value = (data[i] + 256) % 256;
        highIndex = value >> 4;
        lowIndex = value & 0x0f;
        retValue[i * 2 + 0] = hexTable[highIndex];
        retValue[i * 2 + 1] = hexTable[lowIndex];
      return retValue;
    }There are few things (the most important) which I don't understand about the above code.
    I understood that what's returned has got double size related to what's passed in because a char takes 16 bits while a byte takes 8.
    1) I don't understand why each byte must be first added 256 and then % with 256 (returning the same value - Is this to eliminate negative values?)
    2) I do understand that each byte is transformed in two hexadecimal values: one is the highIndex (first 8 bits) and the second is the lowerIndex (last 8 bits) and that each value is tranformed in its hexadecimal value from the array of hex values.
    3) What I don't really understand is why the highIndex is calculated as: value >> 4
    and the lowest index is calculated as value 0x0f (is this last also to eliminate negative values?)
    If someone could clarify this for me, I'd be very grateful.
    Thanks.
    Marco

    So, does this mean that we add 256 to eliminate the sign?No. You need the whole line to convert a signed byte into an int between 0 and 255.
    A simpler way to do this would be
    value = data[i] & 0xFF;
    This moves down the higher bits so that it turnsinto lower bits. i.e. we need it to >be between 0 and
    15.
    Is this shifted of 4 because Math.pow(2, 4) = 16.0?Doing in this case, x >>4 is the same as x / 16
    This leaves only the lowest 4 bits.Is the following what happens?There are no char values produced. Using 0000 as an example is not a good idea as you can change it in many ways and it is still 0000
    >
    Received as initial value:
    byte: 0000 0000
    What we need to obtain:
    char: 0000 0000 0000 0000
    The first 4 bits of the above byte are shifted of 4
    positions to find the hexadecimal equivalent (if from
    2 I want to get to 16 I have to do the opposite of
    powering a number by 4); The last four bits of the
    byte are extracted because of the '&' operator with
    0x0f (which in binary is 1111 - Therefore all the '1'
    are kept)?Yes.

  • Search help - Need to read dynpro of the calling program

    Hello all,
    We have a requirement where we need to read the dynpro of the calling program of a search help.
    Say I have a screen (selection screen, module pool or ALV grid etc) where I have a field PARTNER with whom a custom search help is attached. But on this same screen there is another field RLTYP. What we want is that when an F4 is taken on PARTNER, the value of RLTYP should also be passed as value to the Search help exit.
    In short, we need to read the screen fields of the calling screen of a search help.
    Any ideas are appreciated.
    Regards
    Priyanka

    Check the sample code:
    FUNCTION F4IF_SHLP_EXIT_OFFRCONT.
    ""Local interface:
    *"  TABLES
    *"      SHLP_TAB TYPE  SHLP_DESCT
    *"      RECORD_TAB STRUCTURE  SEAHLPRES
    *"  CHANGING
    *"     VALUE(SHLP) TYPE  SHLP_DESCR
    *"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
      DATA : ws_flag(1) TYPE c,
             ws_rec(1)  TYPE c.
      DATA : i_dynpfields TYPE dynpread OCCURS 0 WITH HEADER LINE.
      DATA : ws_data TYPE ddshiface,
             i_data TYPE ddshifaces.
      ws_flag = 'X'.
      ws_rec = 'X'.
      IF ws_flag = 'X'.
        i_dynpfields-fieldname = 'P_CUST'.
        APPEND i_dynpfields.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            dyname               = sy-cprog
            dynumb               = '1000'
          TABLES
            dynpfields           = i_dynpfields
          EXCEPTIONS
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            OTHERS               = 11.
        READ TABLE i_dynpfields WITH KEY fieldname = 'P_CUST'.
        ws_data-shlpfield = 'ZCUSTOMER'.
        ws_data-valfield = 'G_SIMFIELDS-FIELDNAME'.
        ws_data-value = i_dynpfields-fieldvalue.
        APPEND ws_data TO i_data.
        ws_data-shlpfield = 'ZOFFRCONT'.
        ws_data-valfield = 'P_CONT'.
        ws_data-f4field =     'X'.
        APPEND ws_data TO i_data.
        LOOP AT shlp_tab.
          IF ws_rec = 'X'.
            shlp_tab-interface[] = i_data[].
            APPEND shlp_tab.
            ws_rec = ' '.
          ENDIF.
        ENDLOOP.
        DELETE shlp_tab INDEX 1.
        ws_flag = ' '.
      ENDIF.
    ENDFUNCTION.
    Regards,
    Prakash.

  • Help needed on upgrading portal application from sp3 to weblogic portal 10

    Hi Guys
    I have an application which is currently running on BEA Weblogic Portal 8.1 sp3. We need to upgrade our application from 8.1 sp3 to BEA Weblogic 10 version.
    (1) Is there any way for upgradation from 8.1 sp3 to portal 10 directly or do I need to upgrade it from sp3 to sp4 and then from sp4 to portal 10? Pls clarify?
    (2) How reliable are the BEAs automated scripts for retaining the personalization/customization of my application on sp3 to upgraded version i.e portal 10?
    (3) I believe, we do not need to do any coding/design changes/architectural changes into my application for this upgrade.
    Any help on this will be highly appreciated
    Thanks
    Jameel

    1) I believe only sp4 and later to weblogic 10 is supported (http://www.bea.com/content/news_events/white_papers/BEA_WL_Portal10_ds.pdf)
    so yes i think you need to upgrade from sp3 to a later version of the service pack
    2) You tell us :)
    3) Depends on your application and the features you have used. E.g. I believe Content management has changed between sp3 and what 10 supports.
    regards
    deepak

  • Help Needed!! embeding a swf widget into a flash site

    Hi all.
    I am currently making a flash site for a band, and need to
    embed an external SWF widget into it.
    Its easy enough to embed it into HTML page, but idealy this
    site will endup a single SWF file, to make distribution onto the
    bands various pages (MYspace etc) easier.
    The code to embed in html is:
    <embed src="
    http://www.soundclick.com/player/V2/mp3player200.swf"
    width="200" height="140"
    flashvars="bandid=850463&playType=band&ext=1&testMode=0&autoplay=1"
    name="MP3PlayerBasic" type="application/x-shockwave-flash"
    wmode="transparent" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    />
    Some one told me it should be no probs to embed a swf with
    some sort of LoadMovie command, but he didnt have a qule about
    assigning flashvars to it.
    Any help here would ge greatly apreciated.
    Cheers.
    Sion

    I am listening to you and was letting you know that the code that I am trying to use is probably from an old forum. The code that Flash CS4 cranks out is about 10 pages long which seems a little much just to import an .swf with a transparent background. I don't imagine CS6 would be much shorter.
    From what I gathered, the html file checks to see what version of Flash you're using as well as what browser. The code for that is insane in my opinion and I am trying to keep my html file for my homepage rather small. I had no problem importing this in DW with a transparent background (when I was using DW) but am using Komodo Edit as my HTML editor now as it didn't come with Production Premium that I just got.
    If you know the correct (newer) code, that would import an .swf with a transparency, that would be most be useful. If not I guess I'll just wait for someone to reply that does.
    I will try to extract the code from the CS4 HTML file and use that, but did already try it once and it didn't work. If all else fails, I'll just download a trial version of DW and/or Flash CS6 and see if I can figure out how I did it on a website I developed a couple years ago (that I lost the files from in a HD crash).

  • How do I read directly from file into byte array

    I am reading an image from a file into a BuffertedImage then writing it out again into an array of bytes which I store and use later on in the program. Currently Im doing this in two stages is there a way to do it it one go to speed things up.
    try
                //Read File Contents into a Buffered Image
                /** BUG 4705399: There was a problem with some jpegs taking ages to load turns out to be
                 * (at least partially) a problem with non-standard colour models, which is why we set the
                 * destination colour model. The side effect should be standard colour model in subsequent reading.
                BufferedImage bi = null;
                ImageReader ir = null;
                ImageInputStream stream =  ImageIO.createImageInputStream(new File(path));
                final Iterator i = ImageIO.getImageReaders(stream);
                if (i.hasNext())
                    ir = (ImageReader) i.next();
                    ir.setInput(stream);
                    ImageReadParam param = ir.getDefaultReadParam();
                    ImageTypeSpecifier typeToUse = null;
                    for (Iterator i2 = ir.getImageTypes(0); i2.hasNext();)
                        ImageTypeSpecifier type = (ImageTypeSpecifier) i2.next();
                        if (type.getColorModel().getColorSpace().isCS_sRGB())
                            typeToUse = type;
                    if (typeToUse != null)
                        param.setDestinationType(typeToUse);
                    bi = ir.read(0, param);
                    //ir.dispose(); seem to reference this in write
                    //stream.close();
                //Write Buffered Image to Byte ArrayOutput Stream
                if (bi != null)
                    //Convert to byte array
                    final ByteArrayOutputStream output = new ByteArrayOutputStream();
                    //Try and find corresponding writer for reader but if not possible
                    //we use JPG (which is always installed) instead.
                    final ImageWriter iw = ImageIO.getImageWriter(ir);
                    if (iw != null)
                        if (ImageIO.write(bi, ir.getFormatName(), new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Unable to Write Image");
                    else
                        if (ImageIO.write(bi, "JPG", new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Warning Unable to Write Image as JPEG");
                    //Add to image list
                    final byte[] imageData = output.toByteArray();
                    Images.addImage(imageData);
                  

    If you don't need to manipulate the image in any way I would suggest you just read the image file directly into a byte array (without ImageReader) and then create the BufferedImage from that byte array.

Maybe you are looking for

  • Missing table begin XSL context for: ?end if?

    I have 8 if clauses with grouping sub grouping data shown. when I try to validate my RTF file I am getting following error msg: [061112_073853972][][ERROR] [Line 3322.83] Missing table begin XSL context for: <?end if?> [061112_073854018][][ERROR] [Li

  • User exit or badi or enhance for MIRO using Purchase order

    Hello All,           When Miro was done using Purchase order i want to change the field BSEG-ZUONR value to assign purchase oder number. In the setting when the purhcase order was selected but still it comes as blank. could any body suggest the solut

  • RegisterClass failed when trying to open a pdf

    hi guys I´m using Adobe Reader 9.1.0 and I quite often get that error message when I try to open a pdf-file: RegisterClass failed Have you ever heard of that problem? Perhaps one of u knows an answer! Tanks a lot Chris

  • MRP list MD05 not displyaing results where as MD04 displays results

    Dear Experts, We have a peculiar problem in SAP, MRP list MD05 not displyaing results where as MD04 displays results. Please suggest me how to find out the error and what could be the reasons.

  • HT2106 i have a very gos idea for apple u want to contact you how u can?

    I have a very very good idea for apple that you can do a lot of money uts mean a lot and i want to give you this idea that i can doalso money so contact me i from israel my email adress is [email protected] my phone number is 0525742749