Need some help extracting images from blobs...

hi,
I want to upload a image to a oracle blob and then download it and display it into a browser using jsp. I am new to java as will as oracle and doing a project for the first time. I have searched the internet and found out some links:
http://fdegrelle.over-blog.com/article-992927-6.html
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:232814159006
http://forums.devx.com/archive/index.php/t-142347.html
I feel the solutions given are very vogue and also tried the solutions posted in java forums itself. I would like to have simple example, step by step explanation for uploading an image into a oracle blob,download the image and display it in a browser using a jsp so that i can understand the concepts.
Thank you SUN and JAVA PROGRAMMERS.

thanks yogee,
The creators of these examples have assumed that the developers are advanced users. I am not an advanced user. I am not even a intermediate user.
1.....................................I understood this(Create Table)
create table demo
( id        int primary key,
  theBlob    blob
)/2...................................I understood this too(I suppose we are mapping the folder path)
create or replace directory my_files as '/export/home/tkyte/public_html';3..................................I understood this too(upload the file into the blob)
declare
    l_blob    blob;
    l_bfile    bfile;
begin
    insert into demo values ( 1, empty_blob() )
    returning theBlob into l_blob;
    l_bfile := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen( l_bfile );
    dbms_lob.loadfromfile( l_blob, l_bfile,
                               dbms_lob.getlength( l_bfile ) );
    dbms_lob.fileclose( l_bfile );
end;
/4..................................we are creating a package here. I got it.
create or replace package image_get
as
    procedure gif( p_id in demo.id%type );
end;
/5...................................we are suppose to use this to extract the file from the blob. But where does this get stored?
create or replace package body image_get
as
procedure gif( p_id in demo.id%type )
is
    l_lob    blob;
    l_amt    number default 30;
    l_off   number default 1;
    l_raw   raw(4096);
begin
    select theBlob into l_lob
        from demo
         where id = p_id;
        -- make sure to change this for your type!
    owa_util.mime_header( 'image/gif' );
        begin
           loop
              dbms_lob.read( l_lob, l_amt, l_off, l_raw );
              -- it is vital to use htp.PRN to avoid
              -- spurious line feeds getting added to your
              -- document
              htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
              l_off := l_off+l_amt;
              l_amt := 4096;
           end loop;
        exception
           when no_data_found then
              NULL;
        end;
end;
end;
/6...............................Execute the procedure!
exec image_get
7..................................What after this step?
I do not know servlets. I only know JSP? If you can please write a simple servlet to access the data and display it on the browser
Sample servlet code is in the link as a last user comment. I couldn't understand head or tail.
http://forums.devx.com/archive/index.php/t-142347.html
I appreciate your help.
Message was edited by:
ted_anderson

Similar Messages

  • Needed some help transferring files from Mac to external hard drive

    Hey guys, I just needed some urgent help.
    My friend wanted some files to be transferred to his external hard drive from my Mac. As he is a Windows user, I guess his hard drive is formatted for Windows as well. As I plug in the hard disk in my Mac, I can't transfer the files. It says something like "the disk cannot be modified".
    So, please help me on how can I transfer this files from my Mac and if I do format it to work with the Mac, will it work for Windows later?
    Please help!
    Cheers
    Sam

    The Windows drive is probably formatted NTFS which is not natively writable
    by the Mac. It should be formatted as FAT32 to be usable on both.
    Dave

  • Need some help with Image Processor

    Hi there,
    I have alot of images i need to resize for a website. These images are all different sizes, from 250x400(h) to 200x800(h). I need these ALL to fit in a 246x327 canvas, in their original proportions, regardless of white space.
    Does anybody know if this is possible? So far all my results have failed and the image processor just seems to resize in proportion up to a maximum of 246x327, so nothing is that EXACT size, but all images will fit now fit INTO 246x327. I'm just not sure what to do now.
    Any help is greatly appreciated.
    - Tim

    You can do this with a script.
    Save the code into the presets/scripts folder as filename.jsx you can then include the script in an action. Use "Insert Menu Item" from the action pallete fly-out menu and select File - Scripts - select the script.
    function main(){
    if(!documents.length) return;
    var doc = activeDocument;
    var White = new SolidColor();
    White.rgb.hexValue = 'ffffff';
    // target size =  246x327
    FitImage(240, 321 ); //width - height change to suit
    app.backgroundColor = White;
    doc.resizeCanvas(new UnitValue(246,"px"), new UnitValue(327,"px"), AnchorPosition.MIDDLECENTER);
    main();
    function FitImage( inWidth, inHeight ) {
    var desc = new ActionDescriptor();
    var unitPixels = charIDToTypeID( '#Pxl' );
    desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
    desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
    var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
    executeAction( runtimeEventID, desc, DialogModes.NO );
    Edit:-
    You don't even need the script! as the size isn't dependant on orientation so after the Fit Image you can use Image - Canvas Size in your action.

  • Need some help with image processing

    I have an application where I am reading Code 128 barcodes.  Currently I process the images using IMAQ BCG Lookup with B=130, C=60, and G=0.75.  This works for about 96% of the images.  The other 4% of the images won't decode.  I've fiddled with the BCG settings, but can't get any better yield. 
    The errors I'm getting are:
    -1074396150  not a valid Code 128 barcode (~65% of failures)
    -1074396142  not a valid linear barcode (~30% of failures)
    -1074395277  doesn't pass checksum (~5% of failures)
    I've attached a couple of images that won't decode.  These are as they came from the camera without any processing. I know it would be good to get higher resolution, but unfortunately, I am stuck with what I have.
    I'm hoping someone with more vision experience than I can suggest a better way to process the images. 
    Thanks
    Attachments:
    noread 1.png ‏224 KB
    noread 3.png ‏248 KB

    You might want to try the BCG before the expansion, also.
    There is only so much you can do with low resolution images.  The gaps between the bars are almost non-existant.  You might be able to do some sort of high pass filter horizontally to increase the contrast after expansion.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • I need some help when exporting from premiere, my audio will not export.

    I am editing a vosot, I have a voiceover track and an interview track. When I play the project back, both are there and play fine, however when I go to export it, there is no audio.
    I really need help ASAP! Thank you.

    Firmware is basically the internal OS (operating system) software in which your iPod runs on.
    A "Firmware update" can be found in iTunes (if you aren't updated to the latest version of internal software for your iPod), which updates your iPod's OS (operating system).
    New firmware update versions usually do not make a noticable change on your iPod, unless the last firmware update contained a bug, where is slowed your iPod down, for example, and the new firmware is tweaked from the last version, and doesn't slow down your iPod anymore.
    Also, iTunes and your computer will call a firmware update/software the "firmware files", because a computer will read what an update contains, by how its files are... just another bit of info.
    I hope that explains it.
    -Kylene
    If any post helps or solves your issue, please mark it that way accordingly. Thank you for helping the boards!

  • I need some help removing light from a stage light from the shot.

    Hey there,
    Recently I shot a music video in a location that worked really well.
    However upon uploading the footage onto Adobe Premiere CS6 onto mac and looking back at the footage there is a huge stage light that is on in the corner of the shot,
    (rookie framing error I know!)
    Naturally the huge stage light (which is yellow/white) was producing a lot of light flare.
    I was wondering if there was any way of seriously reducing or, if possible, completely removing the light that the stage light is producing?
    Any Ideas?
    Thanks!
    Conor

    Hi there,
    I thought when dealing with AWTcomponents suchs as Frames, everything is already running on the event-dispatch thread.
    As far as my understanding goes it is only with swing components (which is what the article you posted is about) such as JFrames, JButtons,etc that are required to be put in the event dispatched thread....
    Am i wrong?

  • How to load images from BLOB to javascript?

    hi, Guys:
    I need to load thumbnail images from BLOB to multiple markers' infowindow in Google map . I have implemented Google map in APEX. I load the data suchas text for every marker's infowindow from Oracle database table with PL/JSON, and infowindow works fine. Could anyone give me a suggestion or example so I know how to load images to javascript?
    Thanks a lot.
    Database: Oracle 11g R2
    APEX: APEX 4.1
    Thanks.
    Sam

    lxiscas wrote:
    hi, VC:
    Thanks for your kind reply. I need to render these images out of APEX session, actually in javascript that is related to Google map markers' infowindow.
    I checked the documents of APEX_UTIL.GET_BLOB_FILE_SRC, but my impression is I need to use it in APEX instead of javascript if my understanding is correct. I already implemented a procedure with PL/SQL to load images from a BLOB column in Oracle database. But the problem is, how can I pass it to javascript code out of APEX to javascript (I could pass text or number from APEX to javascript with PL/JSON though,But I assume that still google map will be within a valid apex session? if so you should be able to use the above api.
    Basically what this api does is generates a kind of url to each blob in the database, not sure how google api's deal with this though. Why don't you give it a try?
    The other option is to make your pl/sql procedure public and then you can generate the json to include the images urls such as:
         "employees" : [{
                   "firstName" : "John",
                   "lastName" : "Doe",
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Anna",
                   "lastName" : "Smith"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Peter",
                   "lastName" : "Jones"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
    }And then you can use this new attribute to populate the images in javascript using standard img tag
    See this tutorial http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm
    I did not find any method in PL/JSON to pass image object)? So far I only found example to load images from local files to javascript.Hmm..I don't think you should load image objects.
    Vikram

  • Help needed for downloading the image from Inage URL

    Hello everyone,
    I need some help regarding setting a timeout for dowloading image from image URL
    Actually I have a hash table with set of image URL's...
    for example:
    http://z.about.com/d/politicalhumor/1/0/-/6/clinton_portrait.jpg
    which gives a image.
    for(Enumeration e = google_image_links.elements() ; e.hasMoreElements() ;) {
                                      //System.out.println("final");
                                       //System.out.println(e.nextElement());
                                       try{
                                            System.out.println("Images download started....");
                                            //System.out.println(e.nextElement());
              //imageio is the BufferedImagereader object     
                                               imageio = ImageIO.read(new URL((String) e.nextElement()));
                                            image_title = created_imagepath +"\\"+ array_words[i] + counter_image_download + "." + "jpg";
                                            img = ImageIO.write(imageio,"jpg", new File(image_title));     
                                            imageio.flush();
                                       }catch(Exception e1){
                                            System.out.print(e1);
                                       if(img){
                                            System.out.println("The image " + image_title + " has been saved to local disk succesfully.");
                                       counter_image_download++;
                                  }//end of for loopi am using the above code to download all the image from the Image URL's that r present in hashtable.
    The problem i have been encountered with is...
    Some URL's does not return any bytes, The code is not totally broken. In such cases, my code is hanging off at that particular URL and waiting to get some output data from the URL. The execution does not proceed furthur But if the URL is a totally broken link, the code is throwing an exception and I am able to handle it successfully.
    But in the case of partially broken links, I am not able to go furthur because the code keeps waiting to get some data.
    So for this reason I want to setup a timer and tell the code to wait for 5-10 min, in that time if it does not get any data, proceed furthur to download other links...
    Please tell me how can I do this.. or plzzz tell me an alternative...
    Please help me ans its a bit urgent plzzzz.
    Thank you,
    chaitanya

    Hello everyone,
    I need some help regarding setting a timeout for dowloading image from image URL
    Actually I have a hash table with set of image URL's...
    for example:
    http://z.about.com/d/politicalhumor/1/0/-/6/clinton_portrait.jpg
    which gives a image.
    for(Enumeration e = google_image_links.elements() ; e.hasMoreElements() ;) {
                                      //System.out.println("final");
                                       //System.out.println(e.nextElement());
                                       try{
                                            System.out.println("Images download started....");
                                            //System.out.println(e.nextElement());
              //imageio is the BufferedImagereader object     
                                               imageio = ImageIO.read(new URL((String) e.nextElement()));
                                            image_title = created_imagepath +"\\"+ array_words[i] + counter_image_download + "." + "jpg";
                                            img = ImageIO.write(imageio,"jpg", new File(image_title));     
                                            imageio.flush();
                                       }catch(Exception e1){
                                            System.out.print(e1);
                                       if(img){
                                            System.out.println("The image " + image_title + " has been saved to local disk succesfully.");
                                       counter_image_download++;
                                  }//end of for loopi am using the above code to download all the image from the Image URL's that r present in hashtable.
    The problem i have been encountered with is...
    Some URL's does not return any bytes, The code is not totally broken. In such cases, my code is hanging off at that particular URL and waiting to get some output data from the URL. The execution does not proceed furthur But if the URL is a totally broken link, the code is throwing an exception and I am able to handle it successfully.
    But in the case of partially broken links, I am not able to go furthur because the code keeps waiting to get some data.
    So for this reason I want to setup a timer and tell the code to wait for 5-10 min, in that time if it does not get any data, proceed furthur to download other links...
    Please tell me how can I do this.. or plzzz tell me an alternative...
    Please help me ans its a bit urgent plzzzz.
    Thank you,
    chaitanya

  • Need some help in saving video message from viber to my Iphone. I disabled the thing that would save photos and videos automatically then, there comes a video I want to save. After loading and watching it, I press the "save to gallery"

    Need some help in saving video message from viber to my Iphone 5S with new ios 8's program . I disabled the thing that would save photos and videos automatically then, there comes a video I want to save. After loading and watching it, I press the "save to gallery" thing but it doesn't save in gallery. I tried all, restarting my phone, rebooting then turning on the save automatically thing and when I watch it again, it still wouldn't save.

    Probably a good question to ask Viber or look at their support site.

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • Need some help with downloading PDF's from the net.

    need some help with downloading PDF's from the net.  Each time I try to click on a link from a website, if it takes me to a new screen to view a pdf, it just comes up as a blank black screen?  any suggestions?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • HT1222 I need some help.... I Have the iPhone 4S and downloaded the new software (6.0) and everything seems great so far except when I try to open a link in safari from a different app (messages, Facebook, ext..) it glitches and won't load. Any advice?

    I need some help.... I Have the iPhone 4S and downloaded the new software (6.0) and everything seems great so far except when I try to open a link in safari from a different app (ie..messages, Facebook, ect..) it glitches and won't load. The blue loading bar will just jump back and forth and the page will not load properly if at all....

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • The backup disk image "/Volumes/Data/David Witkowski's Mac Pro.sparsebundle" is already in use.  Whenever Time Machine starts to backup to Time Capsuel I get the previous error message. I need some help to fix this.

    The backup disk image “/Volumes/Data/David Witkowski’s Mac Pro.sparsebundle” is already in use.  Whenever Time Machine starts to backup to Time Capsuel I get the previous error message Where can I find this disk image?. I need some help to fix this.
    Thanks,
    David W

    There are multiple answers and solutions if you look just to the right under the heading of More Like This.

  • Need some help to unlock the Ipad. Cannot contact the previous owner he is in the shelter and I do not know were. After I restore the Ipad is asking that the previous owner has to remove it from his account

    need some help to unlock the Ipad. Cannot contact the previous owner he is in the shelter and I do not know were. After I restored the Ipad is asking that the previous owner has to remove it from his account

    Nobody on these boards or at Apple will unlock that device for you. Sorry.
    (117810)

  • Need some help with ".png" image.

    Good day everyone. Here's the run down. I need to add an
    image (image "A") ontop of another image (image"B"). Image "B" is a
    paterned background. And Image "A" a logo with a transparent
    background.
    As it stands I have image "A" as a "png" and as you know....
    they are fri**ing huge! Haveing it as a "gif" only presents me with
    the IE6 problem of it adding a colored background to the image.
    So I'm stuck! Can any one tell me or point me in the
    difection of a tutorial to tell me the best way to add an image
    with a transparent background in Dreamweaver.
    Really need some help with this!
    Thanks all!

    >Right you can see the work in progress here>
    http://www.stclairecreative.com/DoughBoys_Site_Folder/home.html
    Before going much further I'd recommend reconsidering the use
    of a textured background. They are usually included for the benefit
    of the site owner only, and likely to annoy visitors. Studies on
    the subject suggest they often lead to usability problems. I do
    like to header graphic, but at 200K it's kinda heavy and can
    probably be optimized.

Maybe you are looking for

  • Successfully restored my MacBook Air from Time Capsule

    This is one occasion where the Superdrive is useless. Here's why if you have an Air and a Time Capsule you should have bought the USB->Ethernet adapter. Don't leave home without it Yesterday it seemed my Air got screwed up so I had to restore from my

  • ITunes won't open on other user

    I can run itunes on the user account that I installed it on, but when I try to run it on another user, it says "itunes has encountered an error and needs to close" before it opens. Both accounts have admin privileges, and were created at the time of

  • Function Module to calculate Open Contract Quantity

    Hi All, Is there a function module to calculate Open Contract Quantity? Thanks.

  • Podcasts not working in iOS 7

    I manually manage my podcasts using a PC running Win 7. Never had a problem before instaling iTunes 11.0 then 11.1. Now when I try and play a podcast on my 5s a window pops up on the iPhone with the following msg: Use Cellular Data   "Would you like

  • Clearing GL Accounts filtering on Profit Center

    Hi Experts, i have a query, i want to clear GL accounts by filtering on Profit Center, is it possible? i am not able to find any layout in F-03 where the Profit Center field is available to choose. What setting is required to be done to get the Profi