I am working on a Java-MySQL project to compute the hash value of a document using JavaMessageDigest. The output is 16 bytes of type Java 'byte'. I store the value in MySQL CHAR types(using Jdbc). When I read back the stored value from MySQL using resultSet.getBytes(); the read hash value is not the same as the stored value. Some characters are differenet. I think the problem must be from a mismatch between MySQL and Java data types or a character coding format.
Can any body please help me how to solve this problem. What data types I should use in MySQL and Java? what character coding should I use?