In our product,when we run a project (Say 'ABC') that inserts blob data into the database(can be MySQL/Oracle/MS-SQL) , but when we execute a select query and retrieve a blob data from database to convert it to original form using java (Here we are writing this output to a file) then the following block of code fails for MySQL but works perfectly fine for MS-SQL.Can we build a code snippet in generic way ?
int length = blobData.length();
byte[] data = new byte[length / 2];
for (int i = 0; i < length ; i += 2)
data[i / 2] = (byte) ((Character.digit(blobData.charAt(i), 16) << 4) + Character.digit(blobData.charAt(i + 1), 16));//Note : blobData is of String type