Based on that table structure we created a procedure named READ_PDF which you will reference below in the dads.conf file below:
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)
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.
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 /
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.
-- -- 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;
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.
# ============================================================================ # 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>
Where are you stuck?
v_http_link := 'http://finas03:8888/pls/findadgen/read_pdf?p_id_document=' || :case_documents.id_document; web.show_document(v_http_link, '_BLANK'); This is where I am stuck. All the steps before this work.
Enter the value in the format of: <NLS_LANGUAGE>_<NLS_TERRITORY>.< NLS_CHARACTERSET>
select value, parameter from nls_database_parameters where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY','NLS_CHARACTERSET'); VALUE PARAMETER ---------------------------------------- ------------------------------ AMERICAN NLS_LANGUAGE AMERICA NLS_TERRITORY WE8ISO8859P1 NLS_CHARACTERSET