[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BLOBs and transaction (misleading BLOB example?)



On Tue, 19 Jun 2001, David V. Olivier wrote:
> I sent a previous post that I was experiencing a problem with the 
> persistence of data in BLOBs.  As long as the same database instance was 
> open I could read and write data, but if I closed and reopened the 
> database, the blob was there but the data was gone.  Finally after much 
> trial and error I discovered that if I wrap the blob creation and write in 
> a transaction, the data is persistent.
> 
> I didn't find this idiosyncrasy in any of the documentation that comes with 
> Blobs although I eventually found it briefly mentioned in the documentation 
> for ExternalTransactions.  The Blob examples seem to be misleading, because 
> although one of them uses an explicit transaction for reading, none of them 
> use transactions for creating or writing blobs.  When I modified the 
> example to close and reopen the database before reading, I had the same 
> problem; the blob was persistent but the data wasn't (note: I also modified 
> the example to run on a local database, but I don't think that should make 
> a difference).  Is anyone aware of more detailed documentation on the use 
> of transactions with blobs?

Using explicit transaction for BLOB operations is more or less mandatory
(although it _should_ work without), since you propably don't want to commit
half of the stream to the database if writing one BLOB page fails. It's the
same as for XML streams (org.ozoneDB.xml.util.XMLContainer). There we have a
check in the source to ensure that the client code has properly opened a
transaction. (the client has to do this since it's hard for the server code to
decide if/when a transaction has to start/commit) Thought we did it for the
BLOB code too... :( Moreover the doc is very weak and the samples should be
more clear... I know.

David, can you correct the BLOBContainer code (see XMLContainer) and maybe
rework the samples?


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com