Retriving zip file stored in database into my own filesystem

Retriving zip file stored in database into my own filesystem

Hi all, I have a table named tempdb with tempid and zipfile as two column.Currently I am using sybase db.

create table tempdb(tempid int,zipfile image)
i have several zip file stored in this table now I want to retrieve it and put it in an directory in my file system.

PreparedStatement psmt=con.prepareStatement("select * from dbo.temp_blob");

   ResultSet rs=psmt.executeQuery();
    while(rs.next())
       {
           System.out.println("PIID IS "+rs.getInt(1));
           //ByteArrayOutputStream byt = new ByteArrayOutputStream(1024);
           //BufferedInputStream bsstream=new BufferedInputStream(rs.getBinaryStream(2));                  
        Blob  b1=rs.getBlob(2);
           byte[] barray=b1.getBytes(1,(int)b1.length());
           File destinationzip=new File("d://dest.zip");
           if(!destinationzip.exists())
           {
               destinationzip.createNewFile();
           }
           FileOutputStream fout=new FileOutputStream(destinationzip);
           ZipOutputStream zpout=new ZipOutputStream(new BufferedOutputStream(fout));
           zpout.write(barray,0,barray.length);

But this not the right approach please tell the proper way to do it.

View Answers









Related Tutorials/Questions & Answers:
Retriving zip file stored in database into my own filesystem
Retriving zip file stored in database into my own filesystem  Hi all... several zip file stored in this table now I want to retrieve it and put it in an directory in my file system. PreparedStatement psmt=con.prepareStatement("select
Retriving data stored in database
Retriving data stored in database  Hi, How to retrive data from my sql database using Hibernate,Spring and tapestry please give me an example.I am new to this Hibernate and Spring
Advertisements
How to browse excel file and stored the contents into the database using jsp/servlet?
How to browse excel file and stored the contents into the database using jsp/servlet?  Hi.. I want to browse excel file and stored the file data into the My-sql database using jsp/servlet
downloading file through a file's path stored in database in jsp
downloading file through a file's path stored in database in jsp  hi want to download a file from a directory where the file location is stored... table,but i dont know hoe to download the file using its path stored
retriving image from database - JSP-Servlet
retriving image from database  how to retrive image from mysql database by using servlet programming  Hi Friend, Please visit the following link: http://www.roseindia.net/servlets/retreiveimage.shtml Thanks
Import My Own Package (Automatically)
Import My Own Package (Automatically)   How can I import my own package in every java program ( automatically )....? For example :- java.lang.String... automatically imported, we need not to import
Resize image stored in database
Resize image stored in database  hi, Can any one please send code for how to resize image stored in database in blob datatype in jsp, i want to resize it to 140(w)*160(h) please help me
sending a zip file to servlet
sending a zip file to servlet  I have created a .zip file in a servlet on the local system(no static ip). The .zip file contains xml files. I have to send it to another servlet which is in a server(has a static ip). I have done
where this file is stored
where this file is stored  thank your sir, but where this file is stored? and how to get the path for further use
Create a new zip file in ZipArchive.
Creating a new Zip file in ZipArchive For creating zip file, use zipArchive () class. Create a new zip file in ZipArchive. Use the conditional statement... will generate a new zip file, in case of failure, it will print failed in creating
How to zip a file using javascrip?
How to zip a file using javascrip?  hi.. can anyone tell me How to zip a file using javascrip
convert zip file to byte array
convert zip file to byte array  Hi,How to convert zip file to byte array,can you please provide program?? Thanks, Ramanuja
convert a file .doc to .zip
convert a file .doc to .zip  hiii, I uploaded a file with extension .doc now i required with .zip   Hi Friend, Try the following code...;TITLE>Display file upload form to the user</TITLE></HEAD> <
Unzip a ZIP File
of the files, which are compressed and stored in the zip file. Here is the code... Unzip a ZIP File       How to unzip (extract) a zip file? How to retrieve elements from
Java file zip
Java file zip In this section, you will learn how to create a zip file. The ZIP file format is used for the distribution and storage of files. It is a compressed format file which takes less space then the original file. The zip file
Creating a ZIP file in Java
say the files are stored in the zip format with compression. The file which... Creating a ZIP file in Java       Zip File: Zip file format is the popular method
zip file upload in php - WebSevices
zip file upload in php  This is not a normal upload. we know the code for normal upload. i need the zip file upload code in php. how to upload zipfile using php? and how to unzip using php? please i dont
Read file zip in J2ME - MobileApplications
Read file zip in J2ME  I would like to read file.zip in J2ME,I don't know how to extract it. Please help me
Create zip file in Java
Create zip file in Java       Introduction In this section, you will know about a zip file. You will also learn how to create a zip file from any file through the java
Can I learn Hadoop on my own?
Can I learn Hadoop on my own?  Hi, I am beginner in Data Science... learn Hadoop on my own? Try to provide me good examples or tutorials links so that I can learn the topic "Can I learn Hadoop on my own?". Also tell me
Can I learn R on my own?
Can I learn R on my own?  Hi, I am beginner in Data Science... on my own? Try to provide me good examples or tutorials links so that I can learn the topic "Can I learn R on my own?". Also tell me which
What is the best way to learn Java on my own?
What is the best way to learn Java on my own?  Hi, I am new to job market and after completing my graduation searching for better IT job in market... tutorials in Java. What is the best way to learn Java on my own?   Hi
check all database stored procedures - JDBC
check all database stored procedures  How to check all database stored procedures in Java
Issue in Converting .zip file to .jar file?
Issue in Converting .zip file to .jar file?  I have a folder called "printpdf.jar". I have changed the .jar to .zip and did some customizations. After which i had "zipped" it again and made as ".jar". Now the final file
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image and store that image in a database
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image and store that image in a database
how to display or retrive an image in jsp whose path is stored in oracle database
how to display or retrive an image in jsp whose path is stored in oracle database  how to display or retrive an image in jsp whose path is stored in oracle database and the image is stored in my pictures folder
How to extract zip file in java.
How to extract zip file in java. In this Example, we will discuss how to extract a ZIP file. We will use ZipInputStream class for creating input stream that take input from ZIP file. The ZipInputStream class is available
HTML(Registration form) to Jsp to stored into MS ACCESS database
HTML(Registration form) to Jsp to stored into MS ACCESS database  i am sending one html file that contain 18 fields these are stored in ms-access database by using jsp code.i want to urgent jsp code. please urgent sir. thank
I need to display parts of my own website on another website in an iframe
I need to display parts of my own website on another website in an iframe  I need to display parts of my own website on another website in an iframe. please refer me how do i do
Where to download spring framework zip file?
Where to download spring framework zip file?  Hi, I am trying to find the link to download the full distribution zip file of the Spring Framework.... Can anyone tell me the url from where I can download the full zip file
How to create a zip file and how to compare zip size with normal text file
How to create a zip file and how to compare zip size with normal text file .../ZipCreateExample.shtml but when i verified the size of zip and normal file,normal file is showing as 12 bytes and zip file was showing 150bytes in Dos prompt.Is there any error
Read a zip file.
in reading a zip file. First select a file to be opened. Name that file into zip file and direct the zipread command to read it through while loop. The zip_entry..., it will executed and file will be closed.  <?php $zipname = zip_open("
How can I to my database to my application
How can I to my database to my application  How can I to my database to my application   Hi, Please see the JDBC discussion thread.ADS_TO_REPLACE_1 Thanks
Listing Contents of a ZIP File
Listing Contents of a ZIP File     ... of a zip file through the java code. Following program helps you for the appropriate... list of elements present in the zip file format. Program Result:ADS_TO_REPLACE_1
Zip File Using Java
; This example shows how to create a zip file in java. In other words, we... applications. This example shows how we zip a file through a java program... to write files in the zip file format. This class can be used for both compressed
find zip file length lessthen 5MB
find zip file length lessthen 5MB  import java.io.BufferedReader...(); } else{ System.out.println("zip file...; } } System.out.println("Zip File
Show all the entries of zip file.
Show all the entries of zip file. In this tutorial, We will  discuss how to show all the entries of a zip file.  The ZipFile   class is used...; returns enumeration of zip file entries. The getName() method
How to connect to the database to my application if my database is made up in oracle
How to connect to the database to my application if my database is made up in oracle   How to connect to the database to my application if my database is made up in oracle
How much time will it take to learn machine learning on my own?
How much time will it take to learn machine learning on my own?  Hi... on my own? Try to provide me good examples or tutorials links so that I can learn the topic "How much time will it take to learn machine learning on my
What should I study on my own to become a data scientist?
What should I study on my own to become a data scientist?  Hi, I am... for the tutorials to learn: What should I study on my own to become a data scientist... "What should I study on my own to become a data scientist?". Also
How to make a zip file in java
Description: In this example we will discuss about how to create zip file from the text file. In the following code  ZipOutputStream class from... zip file. Code: import java.io.*; import java.util.zip.
how to create own tld and use it in jspx file
how to create own tld and use it in jspx file  I wanted to add fmt as own tag and internationalize add.title=Add. please help me solve the problem. <!-- Document : add Created on : Mar 4, 2012, 7:00:38 PM
how to create own tld and use it in jspx file
how to create own tld and use it in jspx file  I wanted to add fmt as own tag and internationalize add.title=Add. please help me solve the problem. <!-- Document : add Created on : Mar 4, 2012, 7:00:38 PM
How can I protect my database password ?
How can I protect my database password ?   How can I protect my database password ? I'm writing a client-side java application that will access..., where the connection string to the database, including user and password, is stored
values of Combo boxes are not stored in database - JSP-Servlet
values of Combo boxes are not stored in database   i have some combo box values. when i click the submit button after select combo box values, the values are not going in database. please review the code: function
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image...: 1)page.jsp: Display file upload form to the user UPLOAD THE FILE   Choose the file To Upload:  
date retriving
date retriving  my name is subbareddy.sir i was implementing attendance management .In this project i faced one problem that is when i print date stored in the database displays time with date.but i want print only date.please
How to extract a zip file to a folder in Linux?
How to extract a zip file to a folder in Linux? Step by step command... content of a zip file to a specified directory. If you have a zip file and you... use this command to extract a zip file. This tutorial will explain you how
How to generate hash code of Zip file.
How to generate hash code of Zip file. In this tutorial, we will see how to generate hash code of zip file entries. The ZipFile   class is used to read...;returns enumeration of zip file entries. The hashCode() method of ZipFile

Ads