Display BLOB File (pdf format) from database inside Oracle Form (6i)
hi all.
Apologies for a primitive question owing to the fact that i m new to development. I have a requirement to display a pdf document with in an oracle form. i want to know is there any such control for that? or any hint how to go about it?
thanks in advance
Here I have found my jsp script...
How I get the PDF?
I call my script from pl/sql with
web.show_document('http://my_server/getblob.jsp?id=' || id_from_my_blob_table || '&baza=myhost:1521:sid','_blank');
<%@ page contentType="text/html;charset=windows-1250"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.text.*" %>
<%@ page import="oracle.jdbc.driver.OracleDriver" %>
<%@ page import="oracle.jdbc.driver.OracleResultSet" %>
<%
Connection con = null;
Statement stmt = null;
ResultSet rs= null;
oracle.sql.CLOB clob = null;
oracle.sql.BLOB blob = null;
String datoteka = "";
String host = "http://" + request.getHeader("host") + "/";
%>
<!--Peter Valencic 2003 -->
<html>
<head>
<title></title>
</head>
<%
String tip ="";
String id ="";
String baza ="";
String shema ="";
try
id = request.getParameter("id");
baza = request.getParameter("baza");
shema = request.getParameter("shema");
if (request.getParameter("id")== null)
throw new Exception("id= null");
else if(request.getParameter("id").equals(""))
throw new Exception("id= null");
if (request.getParameter("baza")== null)
throw new Exception("baza= null");
else if(request.getParameter("baza").equals(""))
throw new Exception("baza= null");
if (request.getParameter("shema") == null)
shema ="";
else if (request.getParameter("shema").equalsIgnoreCase(""))
shema="";
else
shema =shema + ".";
catch(Exception e)
out.println("Priąlo je do napake: " + e.toString());
return;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@"+baza,"your_user","your_password");
stmt =con.createStatement();
rs = stmt.executeQuery ("Select * from "+shema+"DOK_VSEBINA_DOKUMENTA_BLOB where ID="+id);
boolean podatkib = rs.next();
if (!podatkib)
out.print("<li>Ni podatkov za ID="+id);
return;
blob = ((oracle.jdbc.OracleResultSet)rs).getBLOB("VSEBINA");
datoteka = rs.getString("NAZIV_DATOTEKE").toUpperCase();
File blobFile = new File(application.getRealPath("/uploads/blob")+"/"+datoteka);
blobFile.createNewFile();
InputStream podatki = blob.getBinaryStream();
FileOutputStream strBlob= new FileOutputStream(blobFile);
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = podatki.read(buffer)) != -1)
strBlob.write(buffer,0,length);
podatki.close();
strBlob.close();
con.close();
out.print("<li>"+host+"in2/uploads/blob/"+datoteka);
response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
//odpremo z jsp-stranjo datoteko..
//response.sendRedirect("");
catch(Exception blobException)
out.print("<li>(BLOB)Napaka pri prebiranju podatkov:</li>"+blobException.toString());
return;
out.println("konec..");
%>
<body>
<form method="post">
Vnesi ID
<input type=text name="id">
<li> <input type=submit name="potrdi" >
</form>
</body>
</html>If you look my "old" script..
first it get 2 parameters baza= database (ip:port:sid), id= id from my table (PK)
at the end of my script I have:
response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
this redirect will redirect you to your file stored on server side..
Because IE knows what file it must open it will open it with PDF reader...
hope this help you..
Edited by: peterv6i.blogspot.com on May 14, 2012 11:14 AM
Similar Messages
-
Could not display output in PDF format from a RDF file
Hi all,
I'm calling a report file (.RDF) from the browser using RWCGI.EXE, and specified the output in PDF format, but it always asking me to download the active-X for the PDF file generated by the report. I have Adobe Acrobat Reader installed on my machine, what could be the problem?
thanks in advance.I had the same problem.
As a quick fix, what I enventually did, if you are using WebDB and CGI, is to create an alias in the cgicmd.dat file.
It worked after.
Example of line:
===============
web41pdf: report=web_41.rdf server=Rep60_Z11734 userid=DEMO6I/DEMO6I@PERSOEM destype=cache desformat=PDF tolerance=1440
Then you call the URL http://<web site>/rw60cgi?web41pdf
Yet I would be glad to understand why I also get this message.
Philippe Dalmas. -
Hi all,
I need to Open a file which is stored in the Data base Table & the Data type is of BLOB so i am populating the data but i need to display the attachment which is stored in the BLOB file when the button is clicked & i am using Oracle 10g
I have been just placed a Button & written the below code in WHEN_BUTTON_PRESSED Trigger & i have tried it out by placing a image icon & WHEN_IMAGE_PRESSED but it's not getting worked
It is Directly Coming in to Exception..
DECLARE
vblob BLOB;
vmime VARCHAR2(30);
BEGIN
select attachment,MIME_TYPE into vblob,vmime
from Table_name_a
where UNIQUE_ID = 16842;--:ITEM_RESULT.DRAWINGNO;
htp.init;
owa_util.mime_header( vmime, false);
-- owa_util.mime_header( 'image/jpeg', false);
-- owa_util.mime_header( 'image/jfif', false);
-- owa_util.mime_header( 'image/gif', false);
-- owa_util.mime_header( 'application/word' , FALSE);-- to read MS WORD doc
owa_util.mime_header( 'application/pdf' , FALSE);-- to read ADObE
message ('attachment type is' ||vmime);
message ('attachment type is' ||vmime);
owa_util.http_header_close;
wpg_docload.download_file(vblob);
exception
when no_data_found then
dbms_output.put_line('1. attachment type is' ||vmime);
-- NULL;
end;
so if any body has any idea Please let me Know
Hope for the Reply.
Thanks & Regards
K Nikethan ReddyHi,
Thanks for the reply,
The Document which u Refer is Showing how to Retrieve the Files from the Local System (i.e by giving the path) but i need to populate it from the database.
K Nikethan Reddy. -
Printing a Oracle PDF Report from within a Oracle Form on Linux
Is there a command I can use in Oracle Forms to invoke a shell script to open a PDF output report stored on a physical location on the Linux server and print it to the printer?
What I'm currently trying to do is send a Report called within Oracle Forms 10g to "DESTYPE=FILE DESFORMAT=PDF DESNAME=directory/filename.pdf". I'm storing all the information about the file and printer information prior to it being run with the RUN_REPORT_OBJECT. What I want to happen is as soon as it finishes generating the file, I want (behind the scenes) is it to locate the file, open, and print it automatically, but never show the output to the user on the screen.
I know with the "DESTYPE=cache DESNAME=filename DESFORMAT=PDF" that it puts the info in the Reports Server / Cache directory, but also opens it in a separate browser window of which you can select the printer at that point. I don't want to do that in this option.
I previously tried to use the "DESTYPE=printer" option but, the issue with it has to deal with fonts. I do not want to store fonts on every printer, given the different types of printers our users have. I can print to the printer but the fonts are all messed up so, not an option.
So, basically I'm trying to replace that option with generating to a PDF, then I don't have to worry about fonts, since I have them all working, then I can just open the PDF file on the server and send to the printer. I was wondering if that is an option available in Oracle Forms when calling reports. I figured that when someone sends the option of "DESTYPE=printer" that it must be calling some shell script on Linux that handles this. I'm just not seeing it.
Any help is appreciated.
ChrisOk, one final question because I want to see how far this can go.
Can I issue this command via the HOST inside the form? Basically I'm telling it to open and send the file to the printer. The vFileName is the directory/filename stored on the Linux Server. I can execute this command on the command line of Linux and it works
HOST( 'lpr -P gt-ybs-ps /u11/app/as10g/tools/web/html/pc_rp00120100210035258.pdf');
I promise this is my last quesion.
Chris -
How do I save multiple files from database using oracle forms?
Forms [32 Bit] Version 10.1.2.3.0 (Production)
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Hello,
I have a form containing a block of records with files set up in a tabular layout. Each row has a checkbox to indicate if that row is selected. What I want to do is allow the user to save each file from checked rows to a directory of their choice on their machine when a button is pressed. Is it possible to do this in one command at the same time using WEBUTIL_FILE to save all the selected files to the same directory, or would I need to loop through each row and call the save dialog each time?
Thanks.I'm not sure I follow. The SAVE_DIALOG is building the path including the filename where the files will be saved. If I have 5 different files I want to save at the same time and only show the dialog once, I will only have a path for one of the files. How could I loop through the rest afterwards?
-
Display multiple rows of datas from database in IDM forms
Hi,
I asked the same question in this forum before and some one answered to use 'FieldLoop'.I tried using that it didn't work.I using IDM version 5.
Heres the code...
EmployeeList is a supposed to be java array which contains java bean object,( EmployeeList -->raStagingObject-->getFname) since it doesn't work I thought I might try with simple list..I might be missing something...I would really apprecite if someone cld let me know...
<Field name='employeeList'>
<Default>
<block>
<defvar name='EmployeeList'>
<null/>
</defvar>
<set name='EmployeeList'>
<list>
<s> Red</s>
<s> Blue</s>
<s> Green</s>
<s> Yellow</s>
</list>
</set>
</block>
</Default>
</Field>
<Field>
<Display class='SimpleTable'/>
<FieldLoop for='name' in='EmployeeList'>
<Field name='XYZ'>
<Display class='Label'>
<Property name='value'>
<ref>name</ref>
</Property>
</Display>
</Field>
</FieldLoop>
</Field>
I also tried while loop(not sure whether which is the best way to approach...but kind of tried this didn't work too...)
Let me know what cld possibily work...
<Field name='while'>
<Default>
<block>
<defvar name='length'>
<null/>
</defvar>
<defvar name='counter'>
<null/>
</defvar>
<set name='length'>
<invoke name='size'>
<ref>EmployeeList</ref>
</invoke>
</set>
<set name='counter'>
<i>0</i>
</set>
<set name='length'>
<sub>
<ref>length</ref>
<i>1</i>
</sub>
</set>
<while>
<cond>
<lte>
<ref>counter</ref>
<ref>length</ref>
</lte>
<block>
<Field>
<Display class='Html'>
<Property name='html' value='<td>'/>
</Display>
</Field>
<Field name='myTextField'>
<Display class='Html'>
<Property name='html' value='mytext'/>
</Display>
</Field>
<Field>
<Display class='Html'>
<Property name='html' value='</td>'/>
</Display>
</Field>
<set name='counter'>
<add>
<ref>counter</ref>
<i>1</i>
</add>
</set>
</block>
</cond>
</while>
</block>
</Default>
</Field>
Instead of html I also tried 'Label' and did invoke on EmployeeList's raStagingObject which is a java bean.I didn't work either.
Thanks,
KaithsHi,
I asked the same question in this forum before and some one answered to use 'FieldLoop'.I tried using that it didn't work.I using IDM version 5.
Heres the code...
EmployeeList is a supposed to be java array which contains java bean object,( EmployeeList -->raStagingObject-->getFname) since it doesn't work I thought I might try with simple list..I might be missing something...I would really apprecite if someone cld let me know...
<Field name='employeeList'>
<Default>
<block>
<defvar name='EmployeeList'>
<null/>
</defvar>
<set name='EmployeeList'>
<list>
<s> Red</s>
<s> Blue</s>
<s> Green</s>
<s> Yellow</s>
</list>
</set>
</block>
</Default>
</Field>
<Field>
<Display class='SimpleTable'/>
<FieldLoop for='name' in='EmployeeList'>
<Field name='XYZ'>
<Display class='Label'>
<Property name='value'>
<ref>name</ref>
</Property>
</Display>
</Field>
</FieldLoop>
</Field>
I also tried while loop(not sure whether which is the best way to approach...but kind of tried this didn't work too...)
Let me know what cld possibily work...
<Field name='while'>
<Default>
<block>
<defvar name='length'>
<null/>
</defvar>
<defvar name='counter'>
<null/>
</defvar>
<set name='length'>
<invoke name='size'>
<ref>EmployeeList</ref>
</invoke>
</set>
<set name='counter'>
<i>0</i>
</set>
<set name='length'>
<sub>
<ref>length</ref>
<i>1</i>
</sub>
</set>
<while>
<cond>
<lte>
<ref>counter</ref>
<ref>length</ref>
</lte>
<block>
<Field>
<Display class='Html'>
<Property name='html' value='<td>'/>
</Display>
</Field>
<Field name='myTextField'>
<Display class='Html'>
<Property name='html' value='mytext'/>
</Display>
</Field>
<Field>
<Display class='Html'>
<Property name='html' value='</td>'/>
</Display>
</Field>
<set name='counter'>
<add>
<ref>counter</ref>
<i>1</i>
</add>
</set>
</block>
</cond>
</while>
</block>
</Default>
</Field>
Instead of html I also tried 'Label' and did invoke on EmployeeList's raStagingObject which is a java bean.I didn't work either.
Thanks,
Kaiths -
Facing challenges during creation of replica of .IDF file/Pdf output from 4.7 system into of Adobe forms in ECC 6.0 system.
If anybody has easy way to make those forms...
Please suggest...Hi Shabeer,
the first thing is that you are running on a very very low RAM.
For ECC 6.0 with dual stack SAP System to run you should have atleast 4 GB of RAM.
For your Dispatcher issue kindly check the status of your Oracle database and the connection from SAP To Database.
You can check the oracle status using brtools utility.
Regards,
Prem -
Convert BLOB in RTF Format to BLOB in PDF Format
Hi
I am having a BLOB in database in RTF format and I want to convert this to BLOB in PDF format. Can this be done ?
Thanks
Jamithi fear not with pl/sql only.
You will need a external tool, in example:
http://www.freedownloadscenter.com/Best/rtf2pdf-font.html -
Print BDS document(in PDF format) from SAP R/3
Hello ,
I have a requirement to print BDS document(in PDF format) from SAP R/3 without user interaction.
In simple way, if I execute the program - PDF document will get printed on local default printer.
Please help me if anybody worked on similar requirement.
Thank you very much,
LiliyaHi Liliya,
First you should create a smartform for BDS Layout and give output parameter like this..
wa_param-langu = sy-langu.
wa_param-no_dialog = 'X'.
wa_param-getotf = 'X'.
wa_param-DEVICE = ' '. " (here you can give the path of your printer)
lv_output_options-tdnewid = 'X'. "Print parameters,
lv_output_options-tddelete = space. "Print parameters,
lv_output_options-tdnoprev = 'X' .
lv_output_options-TDIMMED = 'X' . " it will give the immediate output of form in given output device
I hope it will help you.....
Enjoy... -
How To Generate And Print Reports In PDF Format From EBS With The UTF8 Char
Hi,
I want to know How To Generate And Print Reports In PDF Format From EBS With The UTF8 Character Set in R12.0.4.
RegardsRefer to Note: 239196.1 - PASTA 3.0 Release Information
https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=239196.1
Or, you can use XML Publisher.
Note: 551591.1 - Need Latest XML Publisher / BI Publisher Patches For R12
https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=551591.1 -
Concurrent Requests output file (pdf format) send to email
Friends -
Does any one implemented this.
Submit Conurrent Requests once the requests is completed send the output file(PDF Format) as an attachement to email.
Please provide us steps.
Regards
VSHHi,
See this thread.
concurrent ouput to email
concurrent ouput to email
Regards,
Hussein -
How to access next record from database on to form
hi
i have written the following piece of code to retrieve data from database oon to form...
Try
rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
query = "Select * from [@TEST] where Code = ('" + oform.Items.Item("6").Specific.value + "') "
rset.DoQuery(query)
Catch ex As Exception
SBO_Application.MessageBox(ErrorToString)
End Try
' oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
but i can see only one record on my form controls.... i have placed on more button called " Next" so that i can access next records from DB when i click on "Next" button...
Public Sub NextRecords()
Try
rset.MoveFirst()
While Not rset.EoF
' oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
rset.MoveNext()
End While
rset.MoveNext()
Catch ex As Exception
SBO_Application.MessageBox(ErrorToString)
SBO_Application.MessageBox("Updated")
End Try
End sub
i'm not able to access next records...
plz provide me the solution and code for this how to handle this scenario....From your question and code sample given, I think the problem is you are seeing only the last record when pressing the next button.
In the Next button press, you are coded such a way that it will populate the last record.
Try removing the do..While.. loop and simply code like
if Not rset.EoF
rset.MoveNext()
oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
end if
So when you click next, you can see the next record. Not the last record.
Anoop -
Unable to connect to the 10g Express edition database in oracle forms
hi,
i have installed Oracle Database 10g Express Edition and oracle 10g developer suite. i need to work on oracle forms by connecting to the database of the 10g express edition but unable to do so as i am not aware of the database name or SID.
can any one tell me how to connect to the above database in oracle forms by specifying username, password and database name ?
Thanks,
Vidduspecifying username, passwordSet up your database user, easy way is to grant them the resource role (*strongly* suggest not using sys nor system for user data) here's one command line sqlplus method:
$ sqlplus /nolog
SQL> connect system -- or connect /as sysdba; if system credential is lost/forgotten
SQL> create user username identified by userpasswd default tablespace <tablespace> temporary tablespace <temp tablespace>;
SQL> grant connect, resource to username;
SQL> exit;
> the database name or SID
Its XE "out of the box", with a servicename is XE as well, using the default port 1521 on the host. The install should also set up a tns alias named, oddly enough, XE, with those connection details from the install. It comes with a USERS data tablespace, and TEMP temporary tablespace.
So after the user is created, i.e. with sqlplus:
SQL> connect username/passwd
or if your session is not on the host where the database is running, with a tns alias pointing to the XE install host in place:
SQL> connect username/passwd@xe
From a different client machine you will need a tnsnames.ora entry defining an alias, it could be any name you would prefer to use as long as the entry points the the database host and port with the correct ORACLE_SID or the database service name.
And don't forget to glance over the documentation, it is thorough and helpful as well http://www.oracle.com/pls/xe102/homepage -
Cannot connect to database using Oracle Forms 10g
hi,
I had installed Oracle 10g database and Oracle Forms 10g on Windows Vista Home Basic. However, I was unable to connect to
the database in Oracle Form using scott/scott for database "orcl", with the following error message:
ORA-00604: error occured at recursive SQL level 1
ORA-01009: missing mandatory parameter
However, I could access to the database using this set of username and password. Am I missing something? Thanks.Hi,
After a successful installation of forms 10g in vista, I'm about to run OPatch Universal Installer for the patch 7047034
in order to fix the form bugs. However, I cannot run the command "opatch apply C:\oracle_form\Patch26_Rel_10105\7047034"
with the error "The Oracle Home c:\devsuitehome_1 is not registered with the Central Inventory.". Then I try to create a
oraInst.loc file, but not much change still. The situation is that oracle 10g is installed before oracle developer suite
10g, and when I try to set oracle_home to oracle 10g's path ("C:\oracle\product\10.2.0\db_1") and run "opatch lsinventory",
it returns the correct result; when oracle developer suite 10g's path ("c:\devsuitehome_1") is set as the oracle_home,
the same command would return a different result as "LsInventory: OPatch Exception while accessing O2O".
I've verified through Oracle Universal Installer that the Central Inventory has included both as oracle_home (oracle 10g
and oracle developer suite 10g). I'm very confused now, though it seems that the problem could be solved by registering the
Central Inventory with oraacle developer suite 10g's path. Thanks. -
Displaying image in pdf format - what is this image format?
Hi All,
I have a requirement where I need to embed an image in a pdf report that gets generated in BIP. The image is passed as a byte array from an external application , that BIP should recieve as a parameter and display it. The byte array looks very similar to the image that rtf generates when an image is pasted in it and the default xsl-fo template and style-sheet is created usign the BIP Word Plugin.
The issue that I am facing is that, the byte-code is not getting displayed as an image in the pdf.
When I pasted the image for the corresponding byte code in an rtf and generated the default xslfo file that BIP plugin generates, I am getting a different set of charecters than what is being send to BIP as parameter.
I have read about CLOB and BLOB being queried from database using sql and displayed as image.
I would like to know what exactly is the BIP Plugin converting the image to , when I paste it in an rtf and convert it to xsl-fo style sheet.
If I have not made my query very clear and you are still confused about what I am talking about , please try this out in an rtf template.
1) Open blank rtf template
2) Paste any tiff or jpg image in your rtf template and save it.
3) Goto Addin --> Tools --> Export --> Click on FO Formated XML or XSL FO Style sheet in the Menu
4) An xml document will be opened in your default browser.
5) Scroll down to the section with the tag " <fo:instream-foreign-object"
6) Will see a big charecter set, which I believe is some form of representation of the image pasted in the rtf.
<fo:block>
<fo:instream-foreign-object
content-type="image/png"
width="163.5375pt"
height="53.07pt"
xdofo:alt="An Image"
xdofo:image-uid="fbasadsadaferehgffhghd1dvcxab9">
<xsl:value-of select="$Logo3"/>
</fo:instream-foreign-object>
</fo:block>
WHERE $Logo3 is declared as parameter and
= /9j/4AAQSkZJRgABAgEAYABgAAD/7Q0YUGhvdG9zaG9wIDMuMAA4QklNA+0KUmVz b2x1dGlvbgAAAAAQAGAAAAABAAEAYAAAAAEAAThCSU0EDRhGWCBHbG9iYWwgTGln aHRpbmcgQW5nbGUAAAAABAAAAHg4QklNBBkSRlggR2xvYmFsIEFsdGl0dWRlAAAA ................................................goes on!!! [ 200000+ charecters]
I would like to know what this image type is? Is this a byte array?
If any one has had this and successfully taclkled this sort of requirement please help!!!
Any pointers, explanations in this regard would be really helpful
Thanks in advance
SujithWhat exact version of CF7 are you on?
Maybe you are looking for
-
Error while creating WS link on a button
Post Author: rahulsarma CA Forum: Nsite I am trying to make a WS link to NSite on a button. But i get this message "Can not save web-service credentials to database. Empty key".
-
Exception when running form in debug mode
Hello, appreciate any help on this. everything is fine when oracle forms 10g is run with debug=no, but when debug=yes throws this exception in the sun java console. proxyHost=null proxyPort=0 connectMode=HTTP, native. Forms Applet version is : 10.1.2
-
Stored Procedure Help: Source does not have a runnable target
I'm an MS-SQL guy, so I'm fairly familiar with T-SQL syntax, but am having one heck of a time trying to take code I've written for SQL and transform it to work with Oracle. Anyways, I'm using Oracle's SQL Developer, and I've got a stored procedure th
-
How to execute Excel Marco from SAP using Office Integration Classes
Is there a way to trigger Excel Macro from SAP? I tried using method CALL METHOD document->execute_macro of i_oi_document_proxy but it does not work. Thanks Vivek
-
Revision: 11188 Author: [email protected] Date: 2009-10-27 12:16:37 -0700 (Tue, 27 Oct 2009) Log Message: In 'for each (var in)' statements, defend against undefined entries in the AysncListView/pendingResponders sparse array. QE notes: Doc not