I have a database in mysql. In this I have a table which is storing image in blob format.
From my Java program I want to insert a new image into the table.
But When I tried to convert a byte[] to blob using
java.sql.Blob blob=null;
blob.setBytes(1, myByte );
I am getting null pointer exception.
Again tried by converting:
Blob blob = Hibernate.createBlob(bytes);
But here also got exception wrong format.