Connection connection = null;
PreparedStatement prepareStatement = null;
ResultSet resultSet = null;
String Sql = "select TO_BLOB(PHOTO) PHOTO from SY_USER where ID=?";
try {
connection = KstarOracleDruidDSUtil.getConnection();
prepareStatement = connection.prepareStatement(Sql);
prepareStatement.setObject(1, aoiList.get(0).get("ID").toString());
resultSet = prepareStatement.executeQuery();
//
if (resultSet.next()) {
Blob blob = resultSet.getBlob("PHOTO");
byte[] bytes = blob.getBytes(1, (int) blob.length());
text = "data:image/jpeg;base64," + Base64.getEncoder().encodeToString(bytes);
}
} catch (Exception e) {
// TODO: handle exception
} finally {
KstarOracleDruidDSUtil.close(prepareStatement, connection);
}