When I DUMP a table in MySQL, if it has a blob field, it generates an INSERT with the following format:
INSERT INTO `fotos` VALUES (1,73,_binary 'ÿ\Øÿ\à\0JFIF\....')
I would like my application to generate that INSERT command to perform my own DUMP from my java application.
My question is how do I get the binary string that goes after the _binary from a ResultSet that gives me the statement.executeQuery(sql) ??
I get to get the blob of the field:
Blob blob = resultSet.getBlob(i);
but I don't know how to get the string I need from there.
I don't know what criteria it uses to build the _binary string, some characters are escaped and others are not. So I gave up using that format.
I solved my problem by getting the BLOB field in base64 and building the INSERT with ..., FROM_BASE64(...).
To get the blob in base64 from the resultSet I do:
and the insert is:
All this to be able to make my own DUMP of the base.