Improve company productivity with a Business Account.Sign Up
In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<% // declare a connection by using Connection interface Connection
// declaration part is here..for the database
ResultSet rs = null;
PreparedStatement psmnt = null;
Blob img = null;
byte imgData = null ;
// declare InputStream object to store binary stream of given image.
Connection myConn = DriverManager.getConnection (connectionURL);
psmnt = myConn.prepareStatement("SELECT tax_scan_doc FROM tax_exemption_doc WHERE tax_exempt_doc_id=5639796");
rs = psmnt.executeQuery();
img = rs.getBlob(1);
imgData = img.getBytes(1,(int)img.length());
// byte bytearray = new byte;
OutputStream o = response.getOutputStream();
// FileInputStream fis = new FileInputStream(f);
sImage = rs.getBinaryStream(1);
// close all the connections.
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.