Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is 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?

like image 795
user3001 Avatar asked Dec 02 '22 23:12

user3001


1 Answers

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.

like image 85
Andomar Avatar answered Dec 28 '22 10:12

Andomar