How to insert a pdf or jpeg image into a blob column of a table

How to insert a pdf or jpeg image into a blob column of a table

Hi,
Try This
Loading an image into a BLOB column and displaying it via OAS
The steps are as follows:
Step 1.
Create a table to store the blobs:
create table blobs
( id varchar2(255),
blob_col blob
Step 2.
Create a logical directory in the database to the physical file system:
create or replace directory MY_FILES as 'c:\images';
Step 3.
Create a procedure to load the blobs from the file system using the logical
directory. The gif "aria.gif" must exist in c:\images.
create or replace procedure insert_img as
f_lob bfile;
b_lob blob;
begin
insert into blobs values ( 'MyGif', empty_blob() )
return blob_col into b_lob;
f_lob := bfilename( 'MY_FILES', 'aria.gif' );
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
Step 4.
Create a procedure that is called via Oracle Application Server to display the
image.
create or replace procedure get_img as
vblob blob;
buffer raw(32000);
buffer_size integer := 32000;
offset integer := 1;
length number;
begin
owa_util.mime_header('image/gif');
select blob_col into vblob from blobs where id = 'MyGif';
length := dbms_lob.getlength(vblob);
while offset < length loop
dbms_lob.read(vblob, buffer_size, offset, buffer);
htp.prn(utl_raw.cast_to_varchar2(buffer));
offset := offset + buffer_size;
end loop;
exception
when others then
htp.p(sqlerrm);
end;
Step 5.
Use the PL/SQL cartridge to call the get_img procedure
OR
Create that procedure as a function and invoke it within your PL/SQL code to
place the images appropriately on your HTML page via the PL/SQL toolkit.
from a html form
1. Create an HTML form where the image field will be <input type="file">. You also
need the file MIME type .
2. Create a procedure receiving the form parameters. The file field will be a Varchar2
parameter, because you receive the image path not the image itself.
3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
variable_consecutive.
4. Load the file into table using:
dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
dbms_lob.fileclose(variable_file_name);
commit.
Regards,
Simma........

Similar Messages

  • How can I insert a image into a BLOB column in a table?

    I am using forms6i against a 10gR2 database and I have one table with a BLOB column and I try to insert a image into this column. I get ORA-01461 error.
    The curious case is that in another table with a BLOB column it works very fine.
    What happens with the first table? How can I avoid the error?
    Thanks in advance.

    Hi hyue,
    Thanks for visiting Apple Support Communities.
    If you would like to add an image to a project in iMovie for iOS, see this article for helpful steps:
    iMovie for iOS (iPad): Add photos to a project
    http://support.apple.com/kb/PH3171
    All the best,
    Jeremy

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • Inserting Image into a BLOB column in Oracle9i

    Hi,
    I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
    Same thing is true for CLOB in 9i.
    Would you please try with this code?
    TABLE
    Create table x
    (Id number,
    Name CLOB,
    Pict BLOB);
    WHEN-BUTTON-PRESSED trigge
    declare
         x varchar2(265);
    begin
         x := get_file_name;
         read_image_file (x, 'GIF', 'picture.pict');
    end;
    Take care,
    Tarek

    Forms 9i and Oracle 9i work fine together for this case.

  • How to insert a pdf file from a dynamic location into a table

    Hi friends
    Can any one please let me know how to insert a pdf file into a table from a dynamic location in server.
    suppose say i have a table CUST_BLOB(file_name, file_data). I have a file in directory c:\local having file_name test.pdf
    I want to insert this file in CUST_BLOB. Please help me.
    Thanks in advance.
    --Ahmed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    user620950 wrote:
    Hi friends
    Can any one please let me know how to insert a pdf file into a table from a dynamic location in server. Why dynamic locations on the server?
    Make it a business case that the files should be stored in specific location(s).
    Oracle uses directory objects to point to locations on the file system and, whilst these locations can be altered, it is better practice to set up specific locations and grant permission to the correct users for those locations so that there is full control over who is accessing what on the server. Whilst filenames may be dynamic, I wouldn't recommend using dynamic locations.

  • How can I load a CMYK jpeg image

    How can I load a CMYK jpeg image (originally saved from Photoshop) and then
    turn it into an rgb BufferedImage, in order to display it on screen in an
    applet?
    I first tried ImageIO.read(), but that does not work for cmyk jpegs. I then
    looked into the com.sun.image.codec.jpeg package, and tried methods like
    decodeAsBufferedImage() and decodeAsRaster().
    The first one (decodeAsBufferedImage) returned an image, but it seems that
    it was interpreted as an ARGB, and the colors were incorrect.
    I then read the documentation which (amongst many other things) stated that
    "If the user needs better control over conversion, the user must request the
    data as a Raster and handle the conversion of the image data themselves."
    This made sense, so I took to decodeAsRaster(), only to find that I could
    not figure out how to carry out the desired conversion.
    Of course, I have looked into the documentation for BufferedImage, Raster,
    ColorModel, ColorSpace etc, but after a while I was lost. (Before I got lost
    I read that you can convert images with the help of methods like toRGB,
    toCIEXYZ.)
    I have a feeling that this is probably pretty simple if you just know how to
    do it, but I sure would need some directions here.
    Any help would be appreciated. Thanks.

    You can either use the "Place" command from the main menu, under "File", or you can just open it, select the move tool "V", the click in the image and drag it to the other file's tab.

  • How to import a jpeg image into premier elements 12?

    how do  i import a jpeg image into premier elements 12?

    chuckx
    Just for background information, what computer operating system is your Premiere Elements 12 running on?
    The generalized answer is Add Media/Files and Folders/Projects Assets from where you drag the photo to the Expert view Timeline.
    But all that can generate a mountain of questions about the photo and the project into which it will be going
    a. what are the pixel dimensions of the photo - will or will I not have to resize or crop/resize the photo for the project
    b. is the photo going into a project that will consist of photos and videos
    c. if video inclusion, that leads to questions about the properties of the video so that you can set the project preset to match those
    d. that leads to questions on the best size to have your photo before you import them into this project.
    So, one simple question generates a lot of side questions.
    Please let us know how we might help to sort out the details for your Premiere Elements workflow and its source media.
    Thank you.
    ATr

  • How to set color space to JPEG image with Java advance Imaging

    How to set color space to JPEG image with Java advance Imaging.
    is there any API in JAI which support to set color space.

    I'm definately no guru, but this is how you can change it.
    CTRL + ALT + Click on the part of the component that you want to change. This brings up the Hidden Dom Inspector, background of component will be surrounded with a red outline (Make sure the red outline is surrounding the part of the tabset you want to change), Now you go to properties sheet and click the ellipses next to rules property this will pop up a dialog you look in this list (At the top) to see the default style classes that are affecting the rendering of the component outlined in red. (You will be able to select different sections of a single component) then you just rewrite the style class that you want to change in your Stylesheet (You will not find the styleclass that you want to change because it is a part of your theme .jar but as long as you name it exactly the same and place in your stylesheet it will override the theme .jar style classes) it's actually very easy -- you were right should be a piece of cake for a guru. Don't have the link handy but you can check out Winston's Blog on changing Table Formatting to get this information...It is EXTREMELY useful if you want your apps to have a custom look and not default that comes with Creator Themes.
    Hope this helps you out God knows others have helped me alot!
    Jason

  • How do I type onto a JPEG image?

    How do I type onto a JPEG image?

    Select the type tool, and click anywhere on the image.

  • How do i convert my scanned jpg images into word

    How do i convert my scanned jpg images into word

    No, Acrobat Pro is expensive
    95% of all the professional scanned in books are in PDF, the entire structure and countless years of work have gone into Acrobat being not just the "best" standard for scanned books, but really the ONLY standard for them.
    Yes, many many little programs can convert to PDF after you have them in a file, or even from Safari you can "print as PDF" or "save as PDF"
    however it just saves them as PDF, and you can use Acrobat READER for free,....
    but Reader is just that, a reader, you cannot do pro editing, scale down the file size etc etc, signatures, portfolios etc.
    Ive got a 42 Terabyte collection of PDF books,.....Ive spent too much time staring at PDF books   LoL.

  • I just upgraded to LR4, how do I get all my LR2 images into LR4?

    I just upgraded to LR4, how do I get all my LR2 images into LR4?

    Images are not "in" Lightroom. Image files are on the hard drive, and the Lightroom edits are in the catalog.
    Lr creates a link between the catalog and the image files on the hard drive.
    So, there is no need to bring images from one version of Lr to the other.
    When you install Lr4 it will find your existing catalog and update it (in fact it updates a copy of the catalog); Lr4 will then "know" where your images are because their location is recorded in the catalog.
    It is the unfortunate choice of the word "import" that creates the impression that images are in Lr like eggs in a basket. Nope!

  • How to Upload a PDF file into BLOB column in a table using Forms 9i

    Can anyone tell me how to upload a PDF file from client system using File dialog window and store its content in BLOB column in a table. The file to be uploaded will be in client side.

    Hi,
    please, search a bit on the forum before do a question:
    Just searching by "upload blob pdf" ...
    How to batch upload PDF files into database BLOB
    Regards,
    Jose.

  • How to Upload a PDF file into BLOB column in a table using Forms 6i

    Can anyone tell me how to upload a PDF file from client and store its content in BLOB column in a table. The file will be genered using reports and win be stored in db.The file to be uploaded will be in client side.
    Thank´s.

    If you are using version 9 or 10 use webutil.... Look in webutil.pll.
    Use either one these two fuctions...
    FUNCTION Client_To_DB( clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;
      FUNCTION Client_To_DB_With_Progress
                         (   clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             progressTitle    in VARCHAR2,
                             progressSubTitle in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;

  • How can I copy pictures from google images into MS word for iMac

    how can I copy pictures from google images into MS word for iMac.
    How can I copy pictures from iphoto to MS word for iMac.

    As MS Word is not an Apple product, you may do better posting in the MS forums:
    Office for Mac forums
    Most people find them very helpful

  • Using QuickTime Pro to convert a series of JPEG images into a QT movie?

    Can I use QuickTime Pro to convert a series of JPEG images into a QT (uncompressed) movie? Thanks...
      Windows XP  

    Yes.
    One of the features of the QuickTime Pro upgrade is "Open Image Sequence". It imports your sequencially named (1.jpg, 2.jpg) liked sized images (any format that QT understands) and allows you to set a frame rate.
    http://www.apple.com/quicktime/tutorials/slideshow.html
    You can also adjust the frame rate by adding your image .mov file to any audio clip. Simply "copy" (Command-A to select all and then Command-C to copy) and switch to your audio track.
    Select all and "Add to Selection & Scale". Open the Movie Properties window and "Extract" your new (longer or shorter) file and Save As.
    As you've posted in the Mac Discussion pages but your profile says XP you'll need to subsitute Control key where I reference Command key.

Maybe you are looking for

  • Suggestions for new features & improvements to LCCS/ICS service

    Firstly Hello, I am James from Influxis. if you got a suggestion for a possible improvements or new features to LCCS/ICS feel free to add your suggestions below and we look into it. Thanks, James

  • Could not find jrmc.exe. help required

    i have installed jrmc on windows. i want to access it remotely. http://download.oracle.com/docs/cd/E15289_01/doc.40/e15067/toc.htm according to instructions, it installed properly. i could not find jrmc.exe in my windows, to access it. anyone please

  • Isync not working with E61 when its supported in isync v3

    Hi Guys, I have isynced a Nokia E61 on my mac with no problems, but after backup the data on a pc via Nokia's own software I cannot isync up with the phone on th mac, I can seem to add it as a bluetooth device but when in Isync trying to add the phon

  • Challenge Reponse

    Hello. I am a PC to MAC convert, as of yesterday. YAY! I am having a ball, but feeling a bit computer illiterate now. LOL! Anyway, when on PC I used a "challenge-response" email filtering system that was part of my ZoneAlarm antivirus package. Now th

  • Acrobat 9 Pro - How do I get inserted scanned pages to display the same size as the original file?

    When I insert scanned pages into Acrobat 9 Pro document, the scanned pages display much larger than the original file.  They are all 8.5 x 11, but the inserted pages look HUGE compared to the original pages.  HELP!