• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve blob name from multiple blob rows

 
Kondal reddy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store the file name in the same row as the data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic