I need to read an image byte array from a PostgreSQL table which is done as
byte[] fileBytes = resultsSet.getBytes(1);
When I try to write it to a image file, it does not open (unsupported file type). The following is the code
FileOutputStream fos = new FileOutputStream("D:\\test.png");
fos.write(fileBytes);
fos.close();