How to insert and retreive zip files in to blob column in oracle database?
This is the code to retrieve
while (rs.next() ) {
Blob fileBlobContent = rs.getBlob(1);
String fileName = rs.getString(2);
String value = rs.getString(3);
long fileNum = new Long(value).longValue();
java.io.InputStream is =
((oracle.sql.BLOB) fileBlobContent).getBinaryStream();
FileOutputStream fos =
new FileOutputStream("c:\\temp\\"+fileName);
int c = -1;
while ((c = is.read()) != -1) {
fos.write(c);
This is the code to insert into the row aftre inserting empty blob
// step 3 - now put the contents of the file
int length = 0;
int buff_size = 1024;
//Writer out_clob = ((oracle.sql.CLOB)fileCobContent).getCharacterOutputStream();
OutputStream outstream = ((oracle.sql.BLOB) fileBlobContent).getBinaryOutputStream();
long chars_read = data.length();
byte[] buffer = new byte[buff_size];
while ((length+buff_size) < chars_read) {
outstream.write(buffer, length, buff_size);
length += buff_size;
//outstream.flush();
// write remaining data
int remaining = (int)(chars_read-length);
outstream.write(buffer, length, remaining);
// steps 4-5:
outstream.flush();
Any help is greatly appreciated. Thanks!
String localStrFile = importFormFileArg.getFileName();
try
localStrFileExt = localStrFile .substring(localStrFile.indexOf(".") + 1);
localInputStream = importFormFileArg.getInputStream();
localBr = new BufferedReader(
new InputStreamReader( localInputStream));
/** Read line by line and count the tokens present */
while ((localStrReadLine = localBr.readLine()) != null)
localIntRecords++;
/* parse the file contents with the delimiter comma */
if ("xls".equalsIgnoreCase(localStrFileExt))
localIsMandatoryPresent = isMandatoryFieldsPresent(
localStrReadLine, ',');*/
System.out.println(localStrReadLine+" first \n\n\n ");
localStk = new StringTokenizer(
localStrReadLine, "\t");
StringTokenizer localStk1 = new StringTokenizer(
localStrReadLine, ",");
// here i am unable to getting the records pls any body helpme }
Edited by: mulamahi on Oct 26, 2007 12:32 AM
Similar Messages
-
How to insert and retrieve zip files in to blob column in oracle database?
Hi All,
I have a requirement where i need to insert zip files to BLOB and retrieve them.
Please suggest me any good example or redirect me to them.You already have a post on this subject here: read and write compressed data from blob in ADF
Please do not post duplicate questions. -
HOW TO READ AND OPEN Zip files IN MAIL?
Anyone know how to open and read attached zip-files in iPhone 3G mail?
Thanks in advance,
AlessioHi Alessio,
The iPhone does not support reading or uncompressing .zip files.
+Mail attachment support+
+Viewable document types: .jpg, .tiff, .gif (images); .doc and .docx (Microsoft Word); .htm and .html (web pages); .key (Keynote); .numbers (Numbers); .pages (Pages); .pdf (Preview and Adobe Acrobat); .ppt and .pptx (Microsoft PowerPoint); .txt (text); .vcf (contact information); .xls and .xlsx (Microsoft Excel)+
http://www.apple.com/iphone/specs.html
Jason -
How to download and open zip file
Download cannot be done
Hi ratan45,
Does your device support the file type? There are some zip tools in the Google play store that would be helpful with unzipping.
However if it cannot download please try this:
#[http://www.vbaccelerator.com/home/VB/Code/vbMedia/Audio/Lossless_WAV_Compression/Sample_APE_File.asp] click on the sample zip file
# go to about:downloads and click on the file
# Select a app that can open zip files on your device (please find one on Google play if you do not have one)
Do you have an example url where this is not happening? -
How to upload a file to a BLOB column in the DB using PL/SQL???
Hi
I am trying to upload a file to a BLOB column in my database. I wana do this using some pl/sql procedure.I don't wana use webutil. is it possible??? and if so can anybody help me with this???
Regards
ShirazHello,
This is a stored procedure sample that show how insert into CLOB, BLOB and BFILE columns
CREATE OR REPLACE PROCEDURE Insert_document
PC$Type IN DOCUMENT.TYP%TYPE
,PC$Nom IN DOCUMENT.NOM_DOC%TYPE
,PC$Texte IN VARCHAR2
,PC$Image IN VARCHAR2
,PC$Fichier IN VARCHAR2
) IS
L$Blob BLOB;
L$Clob CLOB;
L$Bfile BFILE;
LN$Len NUMBER := dbms_lob.lobmaxsize;
LN$Num NUMBER ;
LN$src_off PLS_INTEGER := 1 ;
LN$dst_off PLS_INTEGER := 1 ;
LN$Langctx NUMBER := dbms_lob.default_lang_ctx ;
LN$Warn NUMBER;
BEGIN
-- Création of new raw --
If PC$Fichier is not null Then
L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Fichier );
End if ;
-- Creation of temporary objetcs --
dbms_lob.createtemporary( L$Clob, TRUE ) ;
dbms_lob.createtemporary( L$Blob, TRUE ) ;
-- Loading text in CLOB column --
If PC$Texte is not null Then
L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Texte );
dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
If dbms_lob.fileexists( L$Bfile ) = 1 Then
dbms_output.put_line(PC$Texte || ' open' ) ;
dbms_lob.loadclobfromfile(
L$Clob, -- Destination CLOB
L$Bfile, -- Source file pointer
LN$Len, -- # bytes to read
LN$src_off, -- Source start position
LN$dst_off, -- Target start position
dbms_lob.default_csid, -- CSID
LN$Langctx, -- Language Context
LN$Warn); -- Warning message
dbms_lob.fileclose(L$Bfile);
Else
raise_application_error( -20100, 'Erreur ouverture ' || PC$Texte ) ;
End if ;
End if ;
-- Loading image in BLOB column --
If PC$Image is not null Then
L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Image );
dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
dbms_lob.loadblobfromfile(
L$Blob, -- BLOB de destination
L$Bfile, -- Pointeur de fichier en entrée
LN$Len, -- Nombre d'octets à lire
LN$src_off, -- Position source de départ
LN$dst_off); -- Position destination de départ
dbms_lob.fileclose(L$Bfile);
End if ;
-- Save --
Insert into DOCUMENT (ID, NOM_DOC, TYP, UTILISE, LOB_TEXTE, LOB_DATA, LOB_FICHIER)
Values( SEQ_DOCUMENT.NEXTVAL, PC$Nom, PC$Type, NULL, L$Clob, L$Blob, L$Bfile ) ;
-- Free the temporary objects --
dbms_lob.freetemporary( L$Clob ) ;
dbms_lob.freetemporary( L$Blob ) ;
END;
/The table structure for this sample is the following:
CREATE TABLE DOCUMENT (
ID NUMBER (5) PRIMARY KEY,
TYP VARCHAR2 (20),
UTILISE VARCHAR2 (30),
LOB_TEXTE CLOB,
LOB_DATA BLOB,
LOB_FICHIER BFILE,
NOM_DOC VARCHAR2 (100))
/Francois -
Storing a file in a BLOB field in the database through forms
Hi, I want to have a form that lets the user choose a file he has on his client side and load this file into a BLOB field in the database.
I know how to use "GET_FILE_NAME" to get the file, the second part is what I'm having problems with. Do I use an OLE object? How do I initailize it? Or what is the best way to go? Thanks.
--BassemAre you looking for something like this?
DECLARE
l_temp clob;
l_text varchar2(2000);
BEGIN
l_temp := httpuritype('http://www.oracle.com/PO.xsd').getclob;
l_text := substr(l_temp, 1, 2000);
dbms_output.put_line(l_text);
END;N.B.: Not Tested...
Regards.
Satyaki De. -
How can u insert and retrieve text files in any format using forms6i.
how can u insert and retrieve text files in any format using forms6i.
can u give me an example of an insert statement, let's assume the file is located in the a:drive.
and retrieving the files, i would give the user a list of all the files that are in the database, the user would select one, but what command(or piece of code) would open the file in its apppropriate editor.
e.g .pdf formatted file would open in acrobat.
any help would be appreciated.
Thanks
Hussein Saigerthe filereference class is for downloading and uploading files.
if you want to load xml, use the xml class.
and, if you want to write to an xml file and don't want to use server-side code, wait. -
Is there a way to restore photos from Drop box to my desktop iPhoto in a large batch instead of one at a time? I tried and a zip file was downloaded but won't open. Says file format not recognized. I see how to do it one at a time with the "download" button in Dropbox but that's so cumbersome for lots of photos.
Have you tried these avenues?
Contact us - Dropbox
Dropbox Help Center
Dropbox Forums
Submit a help request - Dropbox
OT -
I want to read a file which is in a zip and this zip file is at ftp site
i am facing this problem and try to find the solution from last month please help me
i want to read a file which in ziped and this zip file is at ftp site. and i want to read this file without downloading this zip file to local machine. i have to read it from ftp location onlyYou can open an URLConnection to a file on an FTP server (search this forum to find out how). You can get the InputStream from the URLConnection and feed it to ZipInputStream. That should do the job.
-
How to insert text in existing file.?????
how to insert text in existing file.?????
my file contains simple text with numbers of lines having more then 10 MB size and it might be increase up to 100MB.
i required to seek to spec. position and insert chunk of characters to file without overwriting existing one.
I tried out with RandomAccessFile class Also.
Pl. Suggest me way to insert String in existing file.
Thanks ,
Timirhow to insert text in existing file.?????You can't "insert" text into an existing file. You can
overwrite portions of an existing file or extend one by
writing past the current end of file.
If you want to insert text into a file you have to write
out a new file. -
Retreiving zip file attachement
Hi,
How can I read a zip file attachment that is sent
inline in the message?
thanks,
dannyyI dont think
u can do much with the zipped attachments only solution would be to give the download option for this zipped attachment and i think u know how to do it
[email protected]
regards
hari -
How to create and sign CAB files info on Supplement Option
To all Supplement Option subscribers:
At the supplement option for iDevelopment Accelerators, I uploaded a zip with detailed info on how to create and sign CAB files (necessary when you are running your application on the Native IE Java Virtual Machine).
Not all functionality provided to you through JInitiator will work (e.g. WebUtil doesn't) but the way how to make and sign a CAB file will become more easy.
Cheers,
Marc Vahsen
Headstart TeamThis defeats the purpose of trying to centralize SAP-related web resources on the SAP server. Typically IIS/Apache or other non-SAP servers are under the control of IT and not the SAP BASIS group.
We simply would like to have a centralized location to store static web files so that they are not overwritten during Portal support pack applications. -
How to insert and delete fragments by clicking a button and how to script it?
I have a question on livecycle. I am collecting the inventor information as a bunch of text fields, each asking for a certain details. Please see below
Now I have grouped them all in to one fragment called inventordetails and saved as .xdp file, so I could reuse this entire block. I want to add a button underneath this block, “ADD MORE INVENTORS” and when clicked this will insert another block and so forth and so on. However I was not sure as to how to insert and delete a fragment. Do you think you can help with this? I appreciate any help in this regard.
Best
Subashini1. I have a subform1 which is flowed
2. I have subform2 inside subform1 which is positioned
3. Inside subform2 I have two buttons 1. ADD INVENTOR 2. DELETE INVENTOR
4. Also inside subform1 I insert a fragment called inventor
Now I want to script the buttons so that when clicked the inventor fragment either gets inserted again or deleted.
I greatly appreciate any help in this regard.
Best
Subashini -
How to insert data from *.dmp file to oracle 11g using Oracle SQL Develope
hi
i backup my database using PL/SQL developer and made *.dmp file
how to insert data from *.dmp file to oracle 11g using Oracle SQL Developer 2.1.1.64
and how to make *.dmp file from sql*plus ?
thanks in advancePl/Sql developer has a config window, there you choose the exec to do the import/export.
Find it and his home version, it may be exp or expdp, the home version is the version of the client where the exp executable is.
Then use the same version of imp or impdp to execute the import, you do not need to use Oracle SQL Developer 2.1.1.64. If you want to use it, you must have the same version in the oracle home that exp/imp of sql developer use. -
How to create a split zip file?
Hi,
Does anybody know how to create a split zip file using only Java?
Lets say I have a file that compressed has a size of 10MB and I need to split it into small files of 1MB each... and then be able to open and uncompress it using winzip or any other compressing tool.
I know how to create a zip file using java.util.zip but I cannot split it...
Thanks,
IgnacioIgnacioKriche wrote:
Thanks for the philosophical advice...
Can anyone help me? Does anyone know if Java API java.util.zip can split a zip file?I'm 99.9 % sure that there is nothing in the Java ZIP APIs to do this but I'm 100% sure I can't be certain.
Maybe you are looking for
-
Mac OS 9 will NOT install on 350MHz iMac
recently i acquired an old imac g three, and it has 256mb of ram and it had a password set on it so i decided to format the disk and installed 10.2 on it. turns out in order to install panther i need to install the firmware update so i have to make a
-
1394 adapter from analog VHS-C to Premiere
I've got a job to copy video from some old VHS-C tapes to DVD. I hope that I can use the 1394 ports (FireWire) on my motherboard or USB 3 for receive analog signal from the camcorder. Which adapter should I buy to be sure that it can be used to Prem
-
Is there a way for you to find out who is "listening" to your iTunes music?
If you enable your music in iTunes to be shared, how can you find out who's connected (or listening)? Is there a way to contact them via iTunes, or some other means (provided you just happen to be on a hotspot of some sort)? I just thought it would b
-
Apllication Deployment without downloading in the cache
Hello, i want to deploy an apllication. Normaly the APP is downloaded to the client´s chache and then installed form the local storage. The APP is very big and i don't want to copy it to the clients`s cache. I want to run it over the LAN. Any ideas t
-
Getting static constants of a class
hi I have this class: package cl.mejorencasa.pedido.modelos public class Pedido implements IPedido public static const ENESPERA:String = "En Espera"; public static const ATENDIENDO:String = "Atendiendo"; publi