Below is my program, while opening PDF nothing has been return, please let me know what else is missing
String sql = "select document from corp_info_docs where CIFO_ID=154";
try {
getConnection();
pstmt = conn.prepareStatement(sql);
ResultSet resultSet = pstmt.executeQuery();
while (resultSet.next()) {
java.sql.Blob myBlob = resultSet.getBlob("DOCUMENT");
java.io.InputStream myInputStream = myBlob.getBinaryStream();
FileOutputStream fos = new FileOutputStream("C:\\BLOB_PDF4.pdf");
byte[] buffer = new byte[256];
int bytesRead = 0;
while ((bytesRead = myInputStream.read(buffer)) != -1) {
fos.write(buffer, 0, bytesRead);
System.out.println("Inside While:");
fos.close();
}
myInputStream.close();
}
} catch (Exception e) {
throw new DAOException("insertSchCorpDoc :" + e);
} finally {
release();
}
}