Dowanload pdf file stored in table as blob data.
Hi,
Ive critical thing to do:
creating a link on a page region to download pdf files stored in a table as blob files.
Ive a set of these pdf files in my table but now i need a way to download(not upload) these files onto local drive....any idea on this is appreciated.
Apex 4.1.x&oracle11g
thanks.
Seawolf68 wrote:
This is a great article for doing bothWell it was in 2009. Where the OP has taken the trouble to supply their APEX version, it helps to provide documentation to match, especially where improved techniques are available: About BLOB Support in Forms and Reports
Similar Messages
-
View pdf file stored in oracle database through oracle forms
Forms [32 Bit] Version 10.1.2.0.2 (Production)
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
Oracle Toolkit Version 10.1.2.0.2 (Production)
PL/SQL Version 10.1.0.4.2 (Production)
Oracle Procedure Builder V10.1.2.0.2 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 10.1.2.0.2 - Production
Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
Oracle Multimedia Version 10.1.2.0.2 (Production)
Oracle Tools Integration Version 10.1.2.0.2 (Production)
Oracle Tools Common Area Version 10.1.2.0.2
Oracle CORE 10.1.0.4.0 Production
I have created external directory and am able to load pdf files in oracle database table called test_blob.
CREATE TABLE test_blob (
id NUMBER(15)
, file_name VARCHAR2(1000)
, image BLOB
, timestamp DATE
I have 2 pdf files in the table. I want to view this pdf from forms when the user clicks on the button. On when-button-pressed trigger I want to show pdf on the screen. Any help is appreciated. Not on the designer. I want to run form application.
SELECT id, file_name,
DBMS_LOB.GETLENGTH(image) Length,
timestamp
FROM test_blob
ID|FILE_NAME|LENGTH|TIMESTAMP
1001|2011 HeartlandEmployeeReferralCard.pdf|353718|1/28/2013 11:44:41 AM
1002|2011 HeartlandEmployeeReferralCard.pdf|353718|1/28/2013 11:51:07 AM
Edited by: user_anumoses on Jan 28, 2013 11:45 AMWe were able to do the same thing with Oracle Application Server and Oracle WebLogic Server. I cannot remember how different the processes were, but it seems like they were very similar. I am going to give you the instructions on how we implemented a "Read PDF" procedure on the WebLogic Server. If you are still on the Application Server you may have to do some Google searches, but it all boils down to the mod_plsql DAD Configuration file.
Our PDF was located in a table with the following structure:
CASE_DOCUMENTS
(id_document NUMBER NOT NULL,
doc_blob BLOB,
note VARCHAR2(240),
created_by VARCHAR2(20) NOT NULL,
created_dt DATE NOT NULL,
case_id NUMBER NOT NULL,
filename VARCHAR2(100) NOT NULL)Based on that table structure we created a procedure named READ_PDF which you will reference below in the dads.conf file below:
CREATE or REPLACE procedure read_pdf (p_id_document IN number)
is
view_file blob;
BEGIN
select doc_blob
into view_file
from case_documents
where id_document = p_id_document;
OWA_UTIL.MIME_HEADER ('APPLICATION/PDF', FALSE);
HTP.P ('CONTENT-LENGTH: ' || DBMS_LOB.GETLENGTH (view_file));
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (view_file);
END;
GRANT EXECUTE ON read_pdf TO financial_user_role -- Name of role to execute
/Basically, you are passing in one parameter and that is the primary key for your table. You are selecting the pdf stored in a BLOB for that primary key. The commands below that allow the pdf to open up so you can view it – we got this off some search we did a few years ago.
Now, you need to add logic to your Oracle Form that will call the procedure above, but the URL is based on the dads.conf file that we will set up below… Anyway, we created a button on the form module with a label of "View". In the WHEN-BUTTON-PRESSED trigger the logic looks like this:
-- The View logic uses the DAD (Database Access Descriptors) method to view a .pdf file from the form.
-- The DAD was created on WebLogic Server with the name findadgen. This allows an http request be made
-- to the database.
declare
v_file varchar2(400);
v_success boolean;
ret_val number;
v_http_link varchar2(400);
begin
-- The format of the link is as follows: hostname:port/pls/DAD_name/procedure_name
v_http_link := 'http://finas03:8888/pls/findadgen/read_pdf?p_id_document=' || :case_documents.id_document;
web.show_document(v_http_link, '_BLANK');
end;The name of our WebLogic Server is "finas03" so that is what is listed in the URL. The "findadgen" is the name of the <Location> in the dads.conf file below, the "read_pdf" is the name of the procedure we created above, the "p_id_document=" is the IN parameter listed in the READ_PDF procedure created above, and the ":case_documents.id_document" is the reference to the primary key in our Oracle Form.
For WebLogic, you can either go through Enterprise Manager (directions below) or update the dads.conf file on the filesystem directly (if you update the dads.conf file directly then skip to step 4 and ignore step 5):
1. Enterprise Manager -> Web Tier -> ohs1
2. Oracle HTTP Server (pull-down) – Administration – Advance Configuration
3. Select File – dads.conf
4. Add something similar:
# ============================================================================
# mod_plsql DAD Configuration File
# ============================================================================
# 1. Please refer to dads.README for a description of this file
# ============================================================================
# Note: This file should typically be included in your plsql.conf file with
# the "include" directive.
# Hint: You can look at some sample DADs in the dads.README file
# ============================================================================
<Location /pls/findadgen>
SetHandler pls_handler
Order allow,deny
Allow from All
AllowOverride None
PlsqlDatabaseUsername financial
PlsqlDatabasePassword sdo_3#d1
PlsqlDatabaseConnectString ffindbTNSFormat
PlsqlNLSLanguage AMERICAN_AMERICA.WE8ISO8859P1
PlsqlAuthenticationMode Basic
PlsqlDefaultPage read_pdf
</Location>You are adding the <Location> section to your dads.conf file. The "finddadgen" is the name that you will reference in a change you fill make to your Oracle Form. The "financial" is the Schema, the "sdo_3#d1" is the password for that Schema, the "ffindb" is the database that the stored procedure is located on, and the "read_pdf" is a stored procedure you will have to create in order to read the pdf.
5. Press the "Apply" Button
6. Obfuscate the DAD password by running the dadTool.pl script located in $ORACLE_HOME/bin (This was done on Unix on our server with the following commands):
$> LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
$> cd $ORACLE_HOME/bin
$> perl dadTool.pl -f /u01/app/oracle/middleware/asinst_1/config/OHS/ohs1/mod_plsql/dads.conf
7. Restart the Oracle HTTP Server using Fusion Middleware Control:
Enterprise Manager -> Web Tier -> ohs1
Oracle HTTP Server – Control – Shutdown
Oracle HTTP Server – Control – Start Up
If you followed the instructions above, you should have created a stored procedure, added logic to your Oracle form to reference that stored procedure, and created an entry in the dads.conf file. Once you move the form onto the server and you restart the HTTP Service, you should be able to view a pdf that is stored in a table directly from your Oracle Form. -
Generate PDF file from oracle Table
We need to populate pdf file into oracle table of column blob through informatica by taking
path\name(/path/filename.PDF) as input from source table.
The pdf file is on some other server so, we need to create a stored procedure which will give pdf file as output from
other server by taking path\name from source table column as mentioned above.
So please suggest how we can create a stored procedure for that purpose.
If possible please share some script.Dear all,am new to oracle report and oracle forms and i know the
basics how to generate the report and to create the form, Now my doubt is, like generating report
from oracle report how to generate the report from oracle from,should i add any command button? and where
to add the coding and what coding ? when i click that command button the report should be generated like oracle
report,what should i do?Please help me to learn.
my table name is 'student' and it has the following columns,
sid,sname,grade,result.
Am using oracle from 10.1.2.0.2 version and
oracle report version is 10.1.2.0.2.
Please give step by step procss.
Thank you. -
How to store PDF files in a table
Hi,
Is there a way to store PDF files in a table? Do I use LOB? How do I automatically read them if I want them to be available in a web site?
Thanks.
CamilleU have to use either BLOBs (internal LOBs) or BFILEs (external LOBs). check out docu. at http://www.akadia.com/services/ora_blob.html
-
How can I read content from PDF file stored in Oracle 9i XMLDB
Hi Friends:
Now I have met one question that I don`t know how to read some String , for example "Hello", from the PDF file stored in the Oracle 9i XMLDB, I have stored that PDF file into the XMLDB now, any suggestions are appriciated . Thank you in advance.You may be able to do something with Oracle Text. The following shows how to get an HTML rendiditon of a binary document. I think you can also get plain text instead of HTML
set echo on
spool xfilesUtilties.log
connect sys/&1 as sysdba
grant ctxapp to &2
connect &2/&3
begin
ctxsys.ctx_ddl.create_policy(policy_name=>'XFILES_HTML_GENERATION', filter=>'ctxsys.auto_filter');
end;
create or replace package xfiles_internal_11010
authid definer
as
function renderAsHTML(sourceDoc BLOB) return CLOB;
end;
show errors
create or replace package body xfiles_internal_11010
as
function renderAsHTML(sourceDoc BLOB)
return CLOB
as
html_content CLOB;
begin
dbms_lob.createTemporary(html_content,true,DBMS_LOB.SESSION);
ctx_doc.policy_filter(policy_name => 'XFILES_HTML_GENERATION',
document => sourceDoc,
restab => html_content,
plaintext => false);
return html_content;
end;
end;
show errors
create or replace package xfiles_utilities_11010
authid current_user
as
HOME_FOLDER constant varchar2(700) := xdb_constants.HOME_FOLDER;
PUBLIC_FOLDER constant varchar2(700) := xdb_constants.PUBLIC_FOLDER;
function renderAsHTML(sourceFile VARCHAR2) return CLOB;
function transformToHTML(xmldoc XMLType, xslPath VARCHAR2) return CLOB;
end;
show errors
create or replace package body xfiles_utilities_11010
as
function renderAsHTML(sourceFile VARCHAR2)
return CLOB
as
begin
return xfiles_internal_11010.renderAsHTML(xdburitype(sourceFile).getBLOB());
end;
function transformToHTML(xmldoc XMLType, xslPath VARCHAR2)
return CLOB
as
html clob;
begin
select xmldoc.transform(xdburitype(xslPath).getXML()).getClobVal()
into HTML
from dual;
return html;
end;
end;
show errors
grant execute on xfiles_utilities_11010 to public
create or replace public synonym xfiles_utilities for xfiles_utilities_11010
quitMessage was edited by:
mdrake -
Jsp page opening pdf file stored in an ORDDOC type column
Dear All,
i am building a jsp page that opens a pdf file stored in database. if column type is BLOB, i run the prepareStatement and store in a ResultSet, and then BufferedInputStream(result.getBinaryStream("FILE")). it works. page opens the pdf file.
but when column type is ORDDOC, i get this error:
Failure in java.sql.SQLException: Ongeldig kolomtype.: getBinaryStream not implemented for class oracle.jdbc.driver.T4CNamedTypeAccessor
what more do i do to get a pdf(or txt, msword..) file to jsp page and open it?
regards
JerryWe are facing this problem with IE6 browser only. In firefox, it opens fine in a browser window. What configuration should we do in IE6?
Thanks,
Ananth. -
Opening pdf files stored on server
Hi
We have an application in which we display pdf files stored on the server.
Pdf files opens in a new browser.
User selects the invoice number from a list and based on the invoice selected, we get a pdf file from R/3 system. This file is stored in a particular folder on the server. We extract this file from the folder to show it to the user in a separate browser.
This functionality works fine in the development system but not in test system.
We have recently installed our test system and have done all required settings in config tool.
Config Tool --> Display configuration --> HttpHttps --> Root and Alias folder.
But despite this the functionality is not working.
Is there some other setting that I have missed.
Unfortunately these settings were done in the dev system by someone else and I do not have a document for it.
Can anyone help me please.
This is very urgent for me as we are plannning to migrate our production system as well. I may face the same problem over there as well.
Regards
VineetHi,
We have the same requirement at our client end. Could you please guide me for the same?
Regards,
Sachin Mahajan -
How can i display a pdf file stored in my KM from webdynpro link ?
Hi experts,
i try to open my pdf file stored in km, in the same window of my webdynpro java who has the fire link ?
i user tow iviews with inBound and outBound plug, the first one has the fire link and the seconde an iframe witch i set source parameter to my km link where my PDF is stored. Unfortunately, the iFrame don't work correctly, and my PDF is not be displayed
Can you give some advices ?Hi
Recently in my project I came across a scenario where my Web Dynpro Project had to pick the image from KM. The images to be displayed will be placed in KM. This will avoid loading the images into the Web DynPro project. More over when you have KM installed on your EP server, one can use it for storing backend data and resources. The KM Admin will be undertaking this task of uploading the images to predefined folder structures. Through the application path to the image will be provided dynamically giving you the flexibility to decide which image to be displayed according to the business logic.
Getting an image from KM Documents to be used in Web Dynpro
Uploading files to KM repository using Webdynpro APIs
KM with WebDynpro
thanks
Suresh -
How do I open a PDF file stored on the iCloud drive with my iPad?
How do I open a PDF file stored on the iCloud drive with my iPad?
This document explains how:
Opening PDF Files in Reader for iOS (iPhone and iPad) -
How to store a pdf file in a table
Hi
In my project i have to store a pdf
file in the table column.
can anyone tell what wil be the column type
while creating the table in oracle 7.3.4
Thanks
Alok<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Alok Hota ([email protected]):
Hi
In my project i have to store a pdf
file in the table column.
can anyone tell what wil be the column type
while creating the table in oracle 7.3.4
Thanks
Alok<HR></BLOCKQUOTE>
Since you have to store a binary file you
can use LONG RAW.
Thorsten -
Linking to PDF Files in the Table of Contents
I know there is a way to link directly to a PDF file from the table of contents, but it is beyond me. Anyone know how to do this?
Thanks, KathyHi Kathy
It's probably advisable to first add the PDF as a Baggage File. Then when you are creating the TOC entry point, you point at the Baggage File.
If that wasn't what you were hoping to see, you could also do it by simply linking to the PDF as you would a Web Page by specifying the explicit URL that would open the same file if you were doing it using a browser.
Cheers... Rick
Helpful and Handy Links
RoboHelp Wish Form/Bug Reporting Form
Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
Adobe Certified RoboHelp HTML Training
SorcerStone Blog
RoboHelp eBooks -
How do I transfer larger PDF files stored in iBooks to replacement iPad?
How do I transfer larger PDF files stored in iBooks to replacement iPad?
Do you sync with iTunes and are the PDF files in your iTunes library? If they are, sync the iPad with iTunes.
-
Read pdf files stored in icloud drive from ios8
Ok. So how do I Access and read my PDF files stored in icloud drive from my ipad?
I´ve read that there´s no icloud drive App like dropbox and that it has to be done from a third party App. (strange enough), but I can´t seem to find a third party App that connects to icloud drive yet.
Thanks.The Apple website specifically states "Because with iCloud Drive, you can safely store all your presentations, spreadsheets, PDFs, images and any other kind of document in iCloud and access them from your iPhone, iPad, iPod touch, Mac or PC.".
Now, howe do I "store my PDF" and "access them from my iPhone"? -
How to dump table to the flat file, if the table has NVARCHAR data type fie
I need to dump the table to the text file. The table has NVARCHAR data type field and simple select * from table_name does not work. What do I have to do? Do I need convert NVARCHAR to VARCHAR and if yes, then how?
Thanks,
OlegI need to dump the table to the text file. The table has NVARCHAR data type field and simple select * from table_name does not work. What do I have to do? Do I need convert NVARCHAR to VARCHAR and if yes, then how?
Thanks,
Oleg -
Displaying PDF files (stored as BLOBs in Database) using Forms 6i
Hi,
We have PDF and Word documents stored in Database (Version 8.1.7). We are using Oracle Forms 6i as User Interface. Through Forms we could view word documents which are stored in database, using OLE container.
But we could not view PDF files.
It would be more helpful and valuable if I get ideas/suggestions on this.
Thanks in advance,
UmasankarFrank,
You are correct, I totally agree with you.
TOAD software which i suggested was not for user interface but more for testing purpose - To ensure that the documents is uploaded to BLOBS correctly.
I am not a WEB person, but I believe sugnificant coding is required in forms6i/9i with WEB features to display the respective documents.
If, the purpose in ONLY for testing, then TOAD can be used which requires no coding.
-- Shailender Mehta --
Maybe you are looking for
-
How Do I Complain to the Highest-Level re. iTunes Debacle?
I've had the single-worst customer service experience I've ever had with an online retailer when I tried to buy 3 iTunes email gift certificates on Xmas Day, and I want to send the story of this nightmare to someone who might actually care or do some
-
Oracle Spatial 10g R2 Java API
Hi All, I have a JAVA tool said to be written for Oracle Spatial 10g R2 Java API which uses for example the class oracle.spatial.georaster.JGeoRaster. I have to port it to 11g R2. The tool is definitely written for an earlier version, because compila
-
Is it legal for me to upload my Deceaced Dads Music collection to my ITunes Acct
My Father Past away a couple of years ago and my sister gave me a $G memory stick with a number of songs from his collect. I would like to have this on my Ipod and or Phone but not sure it is legal? Can I do this?
-
how do i connect my ipod to my tv and my car stereo to play music?
-
Re : my iphone is locked,
hi my iphone is locked and i forgut my apple id and the passward please help me please please please <Personal Information Edited by Host>