binary data types used in both PostgreSQL and MySQL along with JDBC OK, the main program is written in Java, as part of a number of
servlets, and making use of JDBC. I am using a function from the Java
security API that produces binary data (this would be the message
digest for now, but I need a function that is guaranteed to have a one
to one relation between the input and output and a digest won't give
that to me; the way I am using it, there is about 512 bits of data
output).
The output I am trying to work with is placed in a byte array, and I
see that PostgreSQL has a byte array data type, and MySQL has both
binary data types and blobs. I don't know if PostgreSQL supports BLOBs
since I have yet to find that term in the PostgreSQL documentation.
One disturbing thing I found is that, with PostgreSQL, I will have to
either parse the output and excape any values that are not printable,
or just escape every byte. One question, then, is what impact will
escaping the characters in the byte array have on being able to use the
string stored in PostgreSQL to look up appropriate rows in MySQL
tables. Which of the binary data types in MySQL would correspond best
with the byte array in PostgreSQL.
An alternative would be to source a function that takes an ASCII string
argument and returns an ASCII string result, which has a one to one
relation between the argument and result, and for which the result
looks random. If one where to be found, that would simplify the problem
since the values could be stored as strings and I won't have to worry
about storing binary data until I need to store jpeg or PNG files.
Any suggestions?
Thanks,
Ted |