Hi,

H2 supports a pluggable file system:
http://h2database.com/html/advanced.html#file_system

If you want to make it work, I suggest you implement a file system
implementation that can deal with the kind of file system problems you can
run into. For example, the file system implementation could re-open the
file and retry in a loop.

Regards,
Thomas



On Wed, May 8, 2013 at 7:29 PM, Noel Grandin <[email protected]> wrote:

> Sorry, but no.
> Running things like databases on network shares is generally a bad idea.
>
>
> On Wednesday, 8 May 2013, wrote:
>
>> Hi,
>>
>> We are using H2 in an environment where multiple vms access the database
>> file over a windows network share using
>> AUTO_SERVER=TRUE;AUTO_RECONNECT=TRUE to allow whichever vm can start the
>> database to be the server.
>>
>> We are experiencing some stability issues which look like they are
>> related to access to the network share being lost, at least temporarily.
>>
>> The following exception will start showing in our trace.db file, even
>> after the share is once again accessible:
>>
>> 04-25 13:23:14 database: flush
>> org.h2.message.DbException: IO Exception: "java.io.IOException: Write
>> error"; "//SVR/db/store.h2.db" [90031-168]
>> at org.h2.message.DbException.get(DbException.java:158)
>>  at org.h2.message.DbException.convertIOException(DbException.java:315)
>> at org.h2.store.FileStore.write(FileStore.java:330)
>>  at org.h2.security.SecureFileStore.write(SecureFileStore.java:64)
>> at org.h2.store.PageStore.writePage(PageStore.java:1327)
>>  at org.h2.store.PageStreamData.write(PageStreamData.java:105)
>> at org.h2.store.PageOutputStream.storePage(PageOutputStream.java:146)
>>  at org.h2.store.PageOutputStream.flush(PageOutputStream.java:154)
>> at org.h2.store.PageLog.flushOut(PageLog.java:856)
>>  at org.h2.store.PageLog.flush(PageLog.java:663)
>> at org.h2.store.PageStore.flushLog(PageStore.java:986)
>> at org.h2.engine.Database.flush(Database.java:1780)
>>  at org.h2.store.WriterThread.run(WriterThread.java:86)
>> at java.lang.Thread.run(Unknown Source)
>> Caused by: org.h2.jdbc.JdbcSQLException: IO Exception:
>> "java.io.IOException: Write error"; "//SVR/db/store.h2.db" [90031-168]
>>  at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>> ... 14 more
>> Caused by: java.io.IOException: Write error
>>  at java.io.RandomAccessFile.writeBytes(Native Method)
>> at java.io.RandomAccessFile.write(Unknown Source)
>> at org.h2.store.fs.FileDisk.write(FilePathDisk.java:438)
>>  at org.h2.store.fs.FileUtils.writeFully(FileUtils.java:372)
>> at org.h2.store.FileStore.write(FileStore.java:327)
>>  ... 11 more
>>
>>
>> Other client connections will usually get errors like:
>>
>> org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "STORE_ITEM";
>> SQL statement:
>>
>> If we query for locks (SELECT * FROM INFORMATION_SCHEMA.LOCKS ) there
>> often will not be any.  Calling SHUTDOWN will shutdown the database and
>> allow all the vms to reconnect.
>>
>> If there is a lock, CANCEL_SESSION(<offending session>) will return
>> false.  If we call SET EXCLUSIVE 2, all other connections will be closed
>> except for the connection with the lock.  If we attempt to SHUTDOWN, we get
>> the following error:
>>
>> IO Exception: "java.io.IOException: Write error"; "//SVR/db/store.h2.db";
>> SQL statement:
>> shutdown [90031-168] 90031/90031 (Help)
>>
>> In this scenario, only killing the VM with running the database seems to
>> be the only solution.
>>  Is the any way to capture this exception (i.e. flush error) in the vm
>> in which the server is running and restart the database in response?
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/h2-database?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to