I am trying to save Image at SQL-SERVER Database using procedures .I have a PROCEDURE name with input parameters but I don't have procedure syntax.
BufferedImage imm = ImageIO.read(new File("C:\\MY DATA\\Release 2\\18.jpg"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(imm, "jpg", baos );
baos.flush();
byte[] immAsBytes = baos.toByteArray();
baos.close();
con.setAutoCommit(true);
CallableStatement statement = con.prepareCall(query);
ByteArrayInputStream baisForIndex2 = new ByteArrayInputStream(immAsBytes);
ByteArrayInputStream baisForIndex3 = new ByteArrayInputStream(immAsBytes);
statement.setDate(1, sqlDate);
statement.setBinaryStream(2, baisForIndex2, immAsBytes.length);
statement.setBinaryStream(3, baisForIndex3, immAsBytes.length);
statement.executeUpdate();
Error msg: Operand type clash: nvarchar is incompatible with image. SQLSTATE: S0002 Error code: 206 Error code: 0
What I want is compatible type of Java with IMAGE type of DB of sql-server.