Show TOC

Background documentationBinary Strings Locate this document in the navigation structure

 

Open SQL for Java supports the following data types to store binary strings:

  • BINARY

  • LONGVARBINARY

  • BLOB

Only columns of the fixed BINARY type are comparable, whereas LONGVARBINARY and BLOB columns are not.

From a functional point of view, LONGVARBINARY and BLOB columns behave the same, but the size restriction imposed on the LONGVARBINARY type allows this type to be mapped to an appropriate VARBINARY type on each supported database platform. On most database platforms, this type is more efficient than the respective BLOB type.

To store binary strings with more than 2,000 bytes, the BLOB type has to be used.

With Open SQL for Java you cannot store empty (zero-length) binary strings in any of these column types, because on some database platforms the empty string is always treated as a NULL value. If you need to represent a custom initial value, you should either use some outstanding value in accordance with your application or consider storing a NULL value explicitly. In the latter case, you should be aware of the NULL value handling in SQL comparisons.

More Information

Using LOBs