Following is the code I have used:
byte[] bkey = key.getEncoded();
String query = \"INSERT INTO keytable (name, key) VALUES (?,?)\";
PreparedStatement pstmt
You should add a binary stream. Do you have access to the inputstream ?? like this..
FileInputStream input = new FileInputStream("myfile.gif");
String query = "INSERT INTO `keytable` (`name`, `key`) VALUES (?,?)";
PreparedStatement pstmt = (PreparedStatement) connection.prepareStatement(query);
pstmt.setString(1, "test");
pstmt.setBinaryStream(2, input, input.available());