Hi,

I don't know what could be the problem. It works for me:

        Connection conn;
        Statement stat;
        DeleteDbFiles.execute("~/temp", "test", false);
        String url = "jdbc:h2:~/temp/test";
        conn = DriverManager.getConnection(url);
        stat = conn.createStatement();
        stat.execute("create table test(id int primary key, date
timestamp)");
        stat.execute("shutdown defrag");
        conn = DriverManager.getConnection(url);
        conn.close();

Could you provide a simple, reproducible test case please?

Regards,
Thomas

On Wednesday, August 5, 2015, Reinier L'abee <[email protected]
<javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:

> Hi all,
>
> I use H2 version 1.4.188 in embeddded mode (mvstore enabled) and when I
> execute the statement DEFRAG SHUTDOWN I'm not able to open a new connection
> anymore. I use a single connection in my application and that gets closed
> when I execute the shutdown statement. (connection.isClosed() returns
> true). But when I then I try to open a new connection it tells me the file
> is locked. Am I missing something here? I believe this used to work a
> couple of months ago. Has something changed, or do I have to review my
> code? ;)
>
> Caused by: java.lang.IllegalStateException: The file is locked:
> nio:C:/H2DB.mv.db [1.4.188/7]
>     at
> org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:773)
>     at org.h2.mvstore.FileStore.open(FileStore.java:167)
>     at org.h2.mvstore.MVStore.<init>(MVStore.java:346)
>     at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2888)
>     at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:154)
>     ... 68 more
> Caused by: java.nio.channels.OverlappingFileLockException
>     at sun.nio.ch.SharedFileLockTable.checkList(Unknown Source)
>     at sun.nio.ch.SharedFileLockTable.add(Unknown Source)
>     at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source)
>     at org.h2.store.fs.FileNio.tryLock(FilePathNio.java:121)
>     at
> org.h2.mvstore.cache.FilePathCache$FileCache.tryLock(FilePathCache.java:152)
>     at java.nio.channels.FileChannel.tryLock(Unknown Source)
>     at org.h2.mvstore.FileStore.open(FileStore.java:164)
>     ... 71 more
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to