Noel (and others),

My sincere apologies: I had turned on filtering (on maven project
resources), and that was modifying the H2 database, and corrupting it.

Once I fixed that, everything was fine.

Again, apologies!
Marco

2011/12/7 Noel Grandin <[email protected]>

>
> Are you sure you're closing the database before copying it?
>
> Are you running under Windows or Linux?
>
> How are you moving the database?
>
> Marco Rietveld wrote:
> > Hi all (Thomas?),
> >
> > I'm getting a "File corrupted while reading record" error with 1.3.161
> > and I can't seem to figure out what I'm doing wrong. I also do
> >     System.setProperty("h2.lobInDatabase", "true");
> > in the code.
> >
> > I am doing something a little wacky, so it might be due to what how
> > and what I'm saving to the db, but I'd like to make sure that there
> > isn't a way to configure h2 to get around this problem.
> >
> > I have a bunch of unit tests that use persistence/JPA (with
> > hibernate).  However, I'm proxying the EntityManager(Factory) and
> > UserTransaction instances used so that when any data is actually
> > committed to the database, a _copy_ of that data is stored elsewhere
> > for later retrieval. I first run the unit tests so that they generate
> > a "base" database, and then I _move_ that .h2.db file to a different
> > location. When the unit tests run again, they save the data and the
> > copy data in a test database -- at the end of each unit test, the data
> > in the test db and the data in a copy of the base db are compared.
> >
> > However, when I'm reading information from the copied base db, I get a
> > "File corrupted while reading record" error, that apparently has
> > something to do with pagestore
> >
> > The stack trace:
> >
> -------------------------------------------------------------------------------------------------------------------------------
> > Caused by: org.h2.jdbc.JdbcSQLException: File corrupted while reading
> > record: "<project-dir>/target/test-classes/marshalling/baseData-
> > current.h2.db". Possible solution: use the recovery tool [90030-161]
> >       at org.h2.message.DbException.getJdbcSQLException(DbException.java:
> > 329)
> >       at org.h2.message.DbException.get(DbException.java:169)
> >       at org.h2.message.DbException.get(DbException.java:146)
> >       at org.h2.store.PageStore.readVariableHeader(PageStore.java:848)
> >       at org.h2.store.PageStore.openExisting(PageStore.java:346)
> >       at org.h2.store.PageStore.open(PageStore.java:278)
> >       at org.h2.engine.Database.getPageStore(Database.java:2090)
> >       at org.h2.engine.Database.open(Database.java:551)
> >       at org.h2.engine.Database.openDatabase(Database.java:219)
> >       at org.h2.engine.Database.<init>(Database.java:214)
> >       at org.h2.engine.Engine.openSession(Engine.java:56)
> >       at org.h2.engine.Engine.openSession(Engine.java:159)
> >       at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
> >       at org.h2.engine.Engine.createSession(Engine.java:121)
> >       at org.h2.engine.Engine.createSession(Engine.java:28)
> >       at
> > org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:
> > 285)
> >       at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
> >       at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
> >       at org.h2.Driver.connect(Driver.java:72)
> >       at
> >
> bitronix.tm.resource.jdbc.lrc.LrcXADataSource.getXAConnection(LrcXADataSource.java:
> > 102)
> >
> -------------------------------------------------------------------------------------------------------------------------------
> >
>
>

-- 
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