Reading Image File into 6i Form
I am attempting to read an image file and display it on an Oracle Form (created in Forms 6i) using the READ_IMAGE_FILE builtin. I have tried it with the same image in several different formats: JPG, TIFF and GIF. The call reads as follows: READ_IMAGE_FILE('D:\mugshot\mug23456.gif','GIF','DESCRIPTION.IMAGE_ITEM'); The file is located in the indicated path on the application server, i.e. the same machine where the form is being run. DESCRIPTION.IMAGE_ITEM is, of course, an Item of type Image. The PL/SQL procedure containing the above call is invoked by an ON-POPULATE-DETAILS trigger defined at the block level (DESCRIPTION is the block in question). Here is the problem: after logging into my Forms 6i application via a login screen, which then runs the form which would be displaying the image item, the form does not appear; all we see is a blank screen. When I remove the DESCRIPTION.IMAGE_ITEM field from the canvas, the form runs as expected, except of course that the image is not read. Is there something special that has to be done to read or display an image, other than what I have already done as described above?
Plz don't Reply
i am able to do it on my own here is the sample code for that
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import javax.swing.text.*;
// this is a function u can use it in a class
private void addEditScroll(){
try{
BufferedReader infile = new BufferedReader(new FileReader("c:\\WS_FTP.log"));
editor =new JEditorPane();
editor.setEditable(false);
editor.read(infile,new PlainDocument());
editor.setSize(new Dimension(450,510));
editorscroll = new JScrollPane(editor);
editorscroll.setSize(new Dimension(450,510));
}catch(Exception ex){
ex.printStackTrace();
-ashish
Similar Messages
-
Cannot read image file in oracle 10g forms, getting error frm-47100
I'm unable to read the image from the file location. But If I do re-save via MS-Paint the same image then I'm able to load successfully. I want to load image directly instead of re-save. Error getting like "frm-47100 Cannot read image file".
Need your co-operation to solve this issue.
Thanks in advance!
declare
tiff_image_dir varchar2(80):=('D:\IMAGE\');
photo_filename varchar2(80);
begin
photo_filename:=tiff_image_dir||:IMAGE_NO||'.JPG';
if :image_no is null then
:Image_no :=:UID_NO;
end if;
read_image_file(photo_filename,'JPG','image');
WRITE_IMAGE_FILE('output.tif','TIFF','g_image_info.image',maximize_compression,original_depth)
end;Hi Sindhu,
By default any operating system file extension starts after the dot. So in this case when it says 2 dots it will think there is something wrong.
RajeshALex -
How to insert a image file into oracle database
hi all
can anyone guide me how to insert a image file into oracle database now
i have created table using
create table imagestore(image blob);
but when inserting i totally lost don't know what to do how to write query to insert image fileHi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
out.println(" <input type='submit' name='submit' value='Submit' class='smalltext'>");
out.println("</form>"); Import this once you have the jar file:
import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
boolean result = true;
String fileName = null;
byte fileData[] = null;
String fileUploadError = null;
String imageType = "";
String error = "";
DiskFileUpload fb = new DiskFileUpload();
List fileItems = fb.parseRequest(request);
Iterator it = fileItems.iterator();
while(it.hasNext()){
FileItem fileItem = (FileItem)it.next();
if (!fileItem.isFormField()) {
fileName = fileItem.getName();
fileData = fileItem.get();
// Get the imageType from the filename extension
if (fileName != null) {
int dotPos = fileName.indexOf('.');
if (dotPos >= 0 && dotPos != fileName.length()-1) {
imageType = fileName.substring(dotPos+1).toLowerCase();
if (imageType.equals("jpg")) {
imageType = "jpeg";
String filePath = request.getParameter("FILE_PATH");
session.setAttribute("filePath", filePath);
session.setAttribute("fileData", fileData);
session.setAttribute("fileName", fileName);
session.setAttribute("imageType", imageType);
return result;
} And now finally the method to actually write the file to the database:
private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
//If the previous code found a file that can be uploaded then
//save it into the database via a pstmt
String sql = "";
UtilDBquery udbq = getUser(request).connectToDatabase();
Connection con = null;
int signatureID = 0;
PreparedStatement pstmt = null;
try {
udbq.setUsePreparedStatements(true);
con = udbq.getPooledConnection();
con.setAutoCommit(false);
if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
pstmt = con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while(rs.next()) {
signatureID = rs.getInt(1);
if (fileName != null && imageType != null) {
sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, signatureID);
pstmt.setBinaryStream(2, is2, (int)(fileData.length));
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
if(mode.equals("U") && signatureIDIn != 0) {
signatureID = signatureIDIn.intValue();
if (fileName != null && imageType != null) {
sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setBinaryStream(1, is2, (int)(fileData.length));
pstmt.setInt(2, signatureID);
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
} catch (Exception e) {
con = null;
throw new Exception(e.toString());
return signatureID;
} -
Want to convert tif image file into jpg image file , pls help me
hey coders, i want to convert a tif image file into a jpg image file , can u all help in this
In it's simplest form, it's two lines of code.
BufferedImage bi = ImageIO.read(/*the tif file*/);
ImageIO.write(bi,"jpeg",/*output file*/);Though, you need to install [JAI-ImageIO|https://jai-imageio.dev.java.net/binary-builds.html] read the tif file into a BufferedImage. -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
Can I insert the image file into PDF file in Adobe X Standard ?
can I insert the image file into PDF file in Adobe X Standard ?
http://matt.coneybeare.me/how-to-make-an-html-signature-in-apple-mail-for-maveri cks-os-x-10-dot-9/
-
When I read image with Read_Image_File procedure i got an error in specified files 'FRM-47100 can not read image c:\abc.jpg'
i think it is on high resolution please promply resolve it. its very urgent
best regards
R E H AN M I R Z AHello,
Found this on Metalink:
Problem Description
You are trying to use READ_IMAGE_FILE in forms to read a JPG image,
but you receive the following error:
FRM-47100: Cannot read image file <file name>
You checked the following:
o You are able to open the image file from Netscape or Internet Explorer and
see your image correctly.
o You are also sure that the file exists under the location mentioned in the
first parameter to READ_IMAGE_FILE built-in.
o You tried other JPG files that are located in the demo directory of the
Developer home and you can see the image loaded in the image item.
Solution Description
There are many JPEG formats. The only JPEG format supported in Forms is the
JPEG File Interchange Format (JFIF) which is the baseline sequential DCT JPEG.
Progressive JPEG (as well as Lossless JPEG and Hierarchical JPEG),
are not currently supported.
Possibly your image file is stored using one of the non-supported formats.
As a workaround, you can convert progressive JPEG format to and from baseline
JPEG. There is a free set of programs provided by the Independent JPEG Group
that allows this.
The Independent JPEG Group home page is: http://www.ijg.org/
Francois -
How can insert a MSWORD file into jdevloper form?
Dear forums
i am a user of jdevloper
and working on client\swing.
i want to insert a microsoft file into my form
but i have no idea abt it.
so plz help me....
thanksYou might want to read a little bit about Jakarta's POI and see if it can help you.
http://jakarta.apache.org/poi/ -
Dears,
I was having forms version 10.1.2.0.2 and I was using webutil to upload an image and to download it. My problem is sometimes the image files are uploaded and sometimes not => I got "Can't read image file D:\...\image.jpg"
I upgraded to forms 10.1.2.3 and the problem persists.
I'm seeing that the picture resides in the workspace environment and not uploaded to the database.
I'm not limiting the size of the pic in the frmweb.cfg file, instead this limitation occurs on form level.
Hint. If you save this picture in "photoshop" tool, than you can upload the same picture without any problem.
Any suggested help will be appreciated.
Best Regards,
Joe Farah
Edited by: Joe Farah on Feb 26, 2009 11:01 AMYes dear, this is the way that we can follow in order to get rid of this problem. Actually we have to mention to all users of my system to save the image file in this tool. But, it's somehow cumbersome for them as they might not have any of the mentioned imaging tool on their systems, isn't it ?
But isn't there any way to fix this problem ? Or shall I go by using PJC/Java Beans ? We have to find an effective way.. :)
Thanks,
Joe -
Load image file into a LONG RAW column via SQL*Loader
Does anyone know how to load a image file into a LONG RAW column via SQL*Loader?
Thanks
-Hsing-Hua-Are you trying to import the image on the client into Oracle lite, or from the server end into the main oracle database for download to the client?
On our system images are loaded into the the oracle lite database (10g R1 at the moment) on the client (DELL X50 PDA's) into a BLOB (Not LONG RAW) column using Java (relatively standard functionality in Java) as this is what our application software is written in.
From the server end, we do not at the moment load images as such, but we do load the application software into the database for deployment of new versions to the clients (the DMC/DMS updates we have found very unreliable), and the technique should be the same for images. Again the file is imported into a BLOB column.
NOTE a column defined as BLOB on the main Oracle database appears as a LONG VARBINARY on the client Oracle lite database, but the synchronisation process handles the conversion with no problem.
To import into a BLOB column on the server try the following
1) you will need to create a DIRECTORY (CREATE DIRECTORY command) within the database, pointing at a directory on the database server (or accessible from it). This is needed for the file location.
CREATE OR REPLACE DIRECTORY PDA_FILE_UPLOAD AS '/pdaapps/jar/'
NOTE create directory needs to be run as SYSTEM
2) define your table to hold the image and other data. Our tables is
SQL> desc pda_applications
Name Null? Type
ID NOT NULL NUMBER(12)
PDAAT_CODE NOT NULL VARCHAR2(10)
VERSION NOT NULL NUMBER(5,2)
PART_NO NOT NULL NUMBER(3)
FILE_OBJECT BLOB
DEPLOY_APPLICATION_YN NOT NULL VARCHAR2(1)
3) copy the image (or in our case a .jar file) to the database server directory specified in step 1
4) the actual import is done using a DBMB_LOB procedure
PROCEDURE pr_load_file
Module Name : pr_load_file
Description : Main call. Create a new pda_applications record, and import the specified file into it
Version History:
Vers. Author Date Reason
1.0 G Wilkinson 03/02/2006 Initial Version.
(PA_VERSION IN NUMBER
,PA_FILENAME IN VARCHAR2
,PA_PDAAT_CODE IN VARCHAR2
,PA_PART_NO IN NUMBER DEFAULT 1
,PA_DEPLOY IN VARCHAR2 DEFAULT 'Y')
IS
l_FileLocator BFILE;
l_blobLocator BLOB;
l_seq NUMBER;
l_location VARCHAR2(20);
no_params EXCEPTION;
call_fail EXCEPTION;
BEGIN
-- Throw error if required details not present
IF pa_version IS NULL
OR pa_filename IS NULL
OR pa_pdaat_code IS NULL THEN
RAISE no_params;
END IF;
-- Initialize the BLOB locator for writing. Note that we have
-- to import a blob into a table as part of a SELECT FOR UPDATE. This locks the row,
-- and is a requirement for LOADFROMFILE.
SELECT pdaa_id_seq.nextval
INTO l_seq
FROM dual;
-- First create the application record (file is imported by update, not insert
INSERT INTO pda_applications
(ID,PDAAT_CODE,VERSION,PART_NO,FILE_OBJECT,DEPLOY_APPLICATION_YN)
VALUES (l_seq,pa_pdaat_code,pa_version,pa_part_no,EMPTY_BLOB(),pa_deploy);
-- Lock record for update to import the file
SELECT file_object INTO l_blobLocator
FROM pda_applications
WHERE id=l_seq
FOR UPDATE;
-- Initialize the BFILE locator for reading.
l_FileLocator := BFILENAME('PDA_FILE_UPLOAD', pa_filename);
DBMS_LOB.FILEOPEN(l_FileLocator, DBMS_LOB.FILE_READONLY);
-- Load the entire file into the character LOB.
-- This is necessary so that we have the data in
-- character rather than RAW variables.
DBMS_LOB.LOADFROMFILE(l_blobLocator, l_FileLocator
,DBMS_LOB.GETLENGTH(l_FileLocator)
,src_offset => 1);
-- Clean up.
DBMS_LOB.FILECLOSE(l_FileLocator);
-- Create download records for each user associated with the application for sending to the PDA's
-- to install the software
IF pa_deploy = 'Y' then
IF fn_deploy (pa_pdaa_id => l_seq
,pa_pdaat_code => pa_pdaat_code) != 'SUCCESS' THEN
RAISE call_fail;
END IF;
END IF;
EXCEPTION
WHEN no_params THEN
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => 'Missing parameters'
, pa_severity => 'E'
WHEN OTHERS THEN
DBMS_LOB.FILECLOSE(l_FileLocator);
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => SQLERRM
, pa_severity => 'E'
END pr_load_file;
I hope this may be of some help -
How to save image files into SQL Server?
Hello, All:
Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!You need a BLOB field (usually)... Then you can check this tutorial out:
http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
There are other exercises on that site, including one on reading the images back. -
How to update an image file into existing file
how to update an image file into existing file
Hi,
So, i assume you want to change one picture. On Stage, i have edgeAnimate (an image), and
1) i am using the div tag.
So: sym.$("edgeAnimate").css("background-image", "url(images/myImage.png)" ); will change my picture.
Link: CSS properties.
More CSS:
sym.$("edgeAnimate").css( { "background-image": "url(images/myImage.png)", "background-size": "100% 100%", "background-repeat": "no-repeat", "cursor": "pointer" } );
Using a path variable:
var myPath = "images/myImage.png";
sym.$("edgeAnimate").css( { "background-image": "url("+myPath+")", "background-size":"100% 100%", "background-repeat":"no-repeat", "cursor": "pointer" } );
2) i am using the img tag.
I can add a class using Edge Animate user interface.
I choose one class name: "newImage".
So: sym.$(".newImage").css("background-image", "url(images/myImage.png)" ); will change my picture.
Note: I assumed you don’t need to preload your picture. -
Load data in xml file into Pdf form created by LiveCycle Designer
I want to load data in xml file into Pdf form when Pdf opened and Form field will be filled with data from xml file .I try to use $host.importdata("filename.xml"); But i could not find suitable place to run my code. Can anyone give me some advice? thank you.
Hi,
extract your xml and then you can use insert all clause.
here's very small example on 10.2.0.1.0
SQL> create table table1(id number,val varchar2(10));
Table created.
SQL> create table table2(id number,val varchar2(10));
Table created.
SQL> insert all
2 into table1 values(id,val)
3 into table2 values(id2,val2)
4 select extractValue(x.col,'/a/id1') id
5 ,extractValue(x.col,'/a/value') val
6 ,extractValue(x.col,'/a/value2') val2
7 ,extractValue(x.col,'/a/id2') id2
8 from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
2 rows created.
SQL> select * from table1;
ID VAL
1 a
SQL> select * from table2;
ID VAL
2 b Ants -
Read-image-file show jpeg photo cause error
I use read-image-file to show a jpeg photo (edited by ACDSEE) cause frm-47100. I know that Oracle may not support the Jpeg format of ACDSee. But, anyone know how to solve this problem. (I have to keep using ACDSee)
If you remove the metadata from a JPEG it should usually do the trick. I don't know how to do that in ACDSee, though.
-
Trying to download image files into lightrrom 5 on an imac running 10.8.5. Works fine with camera roll section but Icloud section does not appear as source in lightroom. How to access?
You need to sync them in iTunes and download them there, then simply open them from the folder where they are stored in other programs.
Mylenium
Maybe you are looking for
-
How to change default file permissions so others can write to file
We have 15 people sharing files on a network. If we open a file on the network, work on it, and save it, it is readable and writeable for everybody. But if we drag the file off the network, work on it on our own hard drive, and save it, and THEN drag
-
Recovery a password protect excel file.
I have a password protected excel file and now it's corrupted and i can't open it. I tried to open_and_repair feature of excel2010 and different other stuffs, without success. I was wondering if there's a way to remove the password without opening th
-
Hi friends, Developed a report where line size is upto 255. While taking print out the font size becomes very small. Another way is to download list in notepad and then take printout. But this disturbs the column headings. Is there any option to cha
-
Backing up ipod! Too many folders.. easy way to import?
I am backing up over 8500 songs on my iPod.. I am saving them on an external hard drive AND on DVD+R dics just to be sure. I went into the iPod settings under "My Computer" and made the folder unhidden to get the songs... I do NOT want to use any typ
-
Installing CS4 Design Standard as an upgrade from InDesign
Installing CS4 Design Standard as an upgrade from InDesign CS on Mavericks OS but serial numbers not valid. Is there a keystroke to override this hangup?