You are here: Implementation Strategies > Type Handling > Blobs

Blobs

In some cases user has to deal with large binary objects (BLOBs) such as images, video, music, which should be stored in a structured way, and retrieved/queried easily. There are several challenges associated with this task:

Db4o provides you with a flexibility of using 2 different solutions for this case:

  1. Blob (Java package: com.db4o.types.Blob, .NET namespace: Db4oTypes.IBlob)
  2. byte[] arrays stored inside the database file

These two solutions' main features in comparison are represented below:

Blob

  1. every Blob gets it's own file
  2. C/S communication runs asynchronous in separate thread
  3. special code is necessary to store and load
  4. no concerns about activation depth

byte[] array

  1. data in the same file
  2. C/S communication runs in the normal communication thread
  3. transparent handling without special concerns
  4. control over activation depth may be necessary

Storing data in a byte[] array works just as storing usual objects, but this method is not always applicable/desirable. First of all, the size of the db4o file can grow over the limit (256 GB) due to the BLOB data added. Secondly, object activation and client/server transferring logic can be an additional load for your application.

More Reading: