db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: Using StorageFactory to create temporary files
Date Thu, 03 Aug 2006 14:58:42 GMT
Daniel John Debrunner wrote:

> Anurag shekhar wrote:
>>Let me explain why I need a temporary file. I need a storage where
>>blob/clob can be stored before writing into the table. As the size of
>>lob can go upto 2gb its not possible to keep it in memory. I am using
>>the temporary file to keep the byte/string in case the the size grows
>>more than 4k.
>>So the temporary file will be created and accessed from the jdbc driver.
>>I decided to use StorageFactory because it already have the nessasary
>>permission for disk i/o. In case derby is running on a special storage,
>>the StorageFactory will be aware of it and will be able to create
>>temporary file for that device.
> But there is no mechansim on the client to define one is running on "a
> special storage", are you going to define one?
> In this case it seems using the simple java.io.File.createTempFile()
> will solve all of your issues. What benefit do you get from using
> StorageFactory and its *current* set of implementations?

I think this is also true for embedded, using the
java.io.File.createTempFile() is the cleanest solution.

The StorageFactory is there to allow the database store to handle
different file types (jar, classpath, java i/o) and there is a
demonstrated need for this. Thus the database store consistently uses
the StorageFactory interfaces to access files and directories.  The
database store also needs temporary files and it needs them to be
handled using the same api's as the perisisent files. Thus
StorageFactory has a getTempDir() method, it's purpose in life is to
bring temp files into the world of the database store, not a general
purpose mechanism.


View raw message