|
| Dear friends,
We have a servlet which adds binary data to an oracle BLOB fields. But in many occasions the servlet returns a blank page to the browser.
What are the possible reasons for this.
Here is the code of our servlet.
String CommentContent = req.getParameter("content");
ByteArrayInputStream bais = new ByteArrayInputStream(CommentContent.getBytes());
int length = req.getContentLength();
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/MYDB");
Connection Con = ds.getConnection();
PreparedStatement pstmtupd = null;
String SQL = null;
SQL = "UPDATE ATTACHMENTS_TABLE SET FILE_CONTENT=? WHERE "
+ "REF_NUM='"+SelectedRef+"' AND FACILITY_DATE=to_date('"+LastFacilityDate+"','dd/MM/yy')";
pstmtupd = Con.prepareStatement(SQL);
pstmtupd.setBinaryStream(1, bais, length);
pstmtupd.execute();
pstmtupd.close();
bais.close();
Con.close();
session.setAttribute("CommentContent",CommentContent);
req.getRequestDispatcher("FinalCommentsViewNew.jsp").forward(req,resp);
Thanking You,
Chamal.
|
|