Reputation: 700
I want to store images in Db4o using Blobs. How can I store them and how do I get them out again?
Upvotes: 1
Views: 1492
Reputation: 13238
Take a look at this question answer: How to stores and Pictures in Db40?
I repost my answer again, a bit updated with the links to the Java documentation:
There are two basic ways to handle Blobs. Either you store a blob as byte-array in the database or you use the special db4o-Blob-Type. Both have their advantages.
Advantages/Disadvantages with byte array:
Advantages/Disadvantaged with db4o-blobs
For your case I would store a byte[] array with the picture in the Person class. Or you create a special Image-class. This image-class contains then a byte-array with the picture. And a few methods to convert this byte-array from and to a Winforms-bitmap.
Upvotes: 3