943,960 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 237
  • Java RSS
Jul 13th, 2009
0

Image Crashed While Retrive.

Expand Post »
Code for Upload....



strLegalDocId = strMerchantId + strLegalStruct;
String strSql = "{call Insert_FileData(?, ?, ?, ?, ?, ?,?)}";
objCst = objCon.prepareCall(strSql);
objCst.setString(1, strMId);
objCst.setString(2, strLS);
objCst.setString(3, strFieldId);
objCst.setString(4, strFileName);
objCst.setString(5, strLDId);
bFileSize = inpStream.available();
objCst.setBinaryStream(6, inpStream, bFileSize);
objCst.registerOutParameter(7, Types.CHAR);
objCst.executeUpdate();
strStatus = objCst.getString(7);
System.out.println("strStatus : " + strStatus);







Code for Download .......


strSql = "SELECT photo FROM image WHERE photo_Id = '" + strPhotoId + "'";
refCon = ConnectionManager.getConnection();

refSt = refCon.createStatement();
refRS = refSt.executeQuery(strSql);
String imgLen = "";
if (refRS.next()) {
imgLen = refRS.getString("legal_document");
}
refRS=null;
refRS = refSt.executeQuery(strSql);
if (refRS.next()) {
int len = imgLen.length();
byte[] rb = new byte[len];
InputStream readImg = refRS.getBinaryStream("legal_document");
int index = readImg.read(rb, 0, len);
response.reset();
response.setContentType("image/jpg");
response.getOutputStream().write(rb, 0, len);
response.getOutputStream().flush();
}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
narayanabhilash is offline Offline
6 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: intrustion detection system
Next Thread in Java Forum Timeline: Auto Email Sending Based on ExpireDate





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC