mark
mark

Reputation: 62734

What is the difference between VARBINARY and BLOB in hsqldb?

I would like to store files in an hsqldb database. Some files are text files ranging from several KB to hundreds of KB in size and some are binary files which may reach several MB in size.

According to the documentation (http://hsqldb.org/doc/guide/sqlgeneral-chapt.html#sgc_binary_types) I can use the types VARCHAR, VARBINARY and BLOB for storing files.

I think I will store files as binary, in order to be able to store both text and binary in the same way. But I do not understand the difference between the two binary types - VARBINARY and BLOB, except that they have different default length values.

What is the difference between them? Which one is better suited for file content storage?

Upvotes: 0

Views: 6569

Answers (1)

fredt
fredt

Reputation: 24352

VARCHAR or VARBINARY types are not optimal types for storing files of several kilobytes.

You can use the BLOB type. The difference between this and VARBINARY is the dedicated storage mechanism for large object used for BLOB and CLOB.

See here for more details:

http://hsqldb.org/doc/guide/management-chapt.html#mtc_large_objects

Upvotes: 2

Related Questions