File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes How to retrieve blob name from multiple blob rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to retrieve blob name from multiple blob rows" Watch "How to retrieve blob name from multiple blob rows" New topic
Author

How to retrieve blob name from multiple blob rows

Kondal reddy
Greenhorn

Joined: Sep 23, 2003
Posts: 22
Actually I am storing my Jpg files in a single column as multiple rows. So how can I retrieve as JPG files with same names of before stored jpg file names.(I am rertriving as a single file )

lSbrqry.append("SELECT IMAGE FROM CLWF_IMG_FTP ORDER BY IMG_ID");
UTIL_LOGGER.fnWriteLog("CLWF_ejbIMG_FTPBean","CLWF_ejbIMG_FTPBean(fnRetrieveImage)","lSbrqry="+lSbrqry);

lpstmtretdet=lcnret.prepareStatement(lSbrqry.toString());
lrsret=lpstmtretdet.executeQuery();
while (lrsret.next()){
System.out.println("got record");
Blob image = lrsret.getBlob("IMAGE");
System.out.println("inside ejb image = "+image.toString());

InputStream input = image.getBinaryStream();

//if(image.equals("Winter")){
//FileOutputStream output = new FileOutputStream(lStrFtpImage+"Winter.xml");
FileOutputStream output = new FileOutputStream("c:/jk/Winter.jpg");
//}else{

//System.out.println("in EJB else");
//}
System.out.println("inside ejb after putting image = "+image.toString());

// set read buffer size
byte[] rb = new byte[1024];
int ch = 0;
// process blob
while ((ch=input.read(rb)) != -1) {
output.write(rb, 0, ch);

so any one can help how can I retrieve with my old names when I am storing that file names.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Store the file name in the same row as the data.


[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve blob name from multiple blob rows