Sql – the standard SQL type for binary data


I have a function which maps java to SQL types.
As I want to store binary data, is there any type defined by the SQL standard which I can use both in PostgreSQL and hsqldb?

Best Solution

The SQL 92 standard does not define a binary type. PostgreSQL has a bytea type, hsqldb has a binary type.

For a very portable (if not efficient) solution, convert the binary to base64, and store it in a string.