The DISTINCT operation needs to allocate a temporary table, which it
can't do if the database is read-only.

On Tue, May 17, 2011 at 14:03, Valentin Tablan <[email protected]> wrote:
> Here's an example of a full stack trace when this occurs:
> Caused by: org.h2.jdbc.JdbcSQLException: The database is read only; SQL
> statement:
> SELECT DISTINCT "ContentMentions".ID, "ContentMentions".Length FROM
> "ContentMentions" [90097-150]
>        at
> org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
>        at org.h2.message.DbException.get(DbException.java:167)
>        at org.h2.message.DbException.get(DbException.java:144)
>        at org.h2.message.DbException.get(DbException.java:133)
>        at
> org.h2.engine.Database.checkWritingAllowed(Database.java:1616)
>        at org.h2.store.PageStore.logUndo(PageStore.java:1005)
>        at org.h2.store.PageFreeList.allocate(PageFreeList.java:96)
>        at org.h2.store.PageStore.allocatePage(PageStore.java:1138)
>        at org.h2.store.PageStore.allocatePage(PageStore.java:1123)
>        at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:69)
>        at org.h2.table.RegularTable.<init>(RegularTable.java:90)
>        at org.h2.schema.Schema.createTable(Schema.java:551)
>        at org.h2.result.ResultTempTable.<init>(ResultTempTable.java:56)
>        at org.h2.result.LocalResult.addRow(LocalResult.java:238)
>        at org.h2.command.dml.Select.queryFlat(Select.java:509)
>        at org.h2.command.dml.Select.queryWithoutCache(Select.java:597)
>        at org.h2.command.dml.Query.query(Query.java:256)
>        at org.h2.command.dml.Query.query(Query.java:226)
>        at org.h2.command.dml.Query.query(Query.java:37)
>        at
> org.h2.command.CommandContainer.query(CommandContainer.java:78)
>        at org.h2.command.Command.executeQuery(Command.java:178)
>        at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:77)
>
>
>        Thanks,
>        Valentin
>
>
> On Tue, 2011-05-17 at 12:42 +0100, Valentin Tablan wrote:
>>       Hi all,
>>
>> While executing a SELECT query on a read-only database, I'm getting an
>> exception saying the DB is read-only:
>>
>> org.h2.jdbc.JdbcSQLException: The database is read only; SQL statement:
>> SELECT DISTINCT "DocumentMentions".ID, "DocumentMentions".Length FROM
>> "DocumentMentions" WHERE "DocumentMentions".L2_ID IS NULL [90097-150]
>>
>> I would have thought that one can run SELECT queries on read-only DBs.
>> Is that not the case?
>>
>> Other similar queries do not cause the error, so I'm a bit confused as
>> to what the cause may be.
>>
>> Any ideas?
>>
>>       thanks,
>>       Valentin
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups "H2 
> Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/h2-database?hl=en.
>
>

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

Reply via email to