I have a png file which is stored as CLOB in oracle db.
and i want to get this data with jdbc template using below code
LobHandler lob = new DefaultLobHandler();
return jdbcTemplate.queryForObject(
"select table from column",
arr,
(rs, rowNum) -> lob.getClobAsString(rs, "CLOB_DATA")
);
and i am converting to byte array as follows since the encoding in oracle db is WE8MSWIN1252
clob.getBytes(Charset.forName("windows-1252"));
however i get the different bytes when i read the file manually with below code and compare with the db data.
File path = new File("path/to/file");
Files.readAllBytes(path.toPath());
some chars are not loaded correctly. what could be the problem?