Apologies, I had already tried this in the environment the database was 
created with, using H2 1.4.199 and got the following error:
2021-01-25 14:57:04,226 ERROR main h2database - mydatabase:database opening 
mydatabase
org.h2.message.DbException: Table "FRUITS" not found [42102-199]
at org.h2.message.DbException.get(DbException.java:205)
at org.h2.message.DbException.get(DbException.java:181)
at 
org.h2.command.ddl.AlterTableAddConstraint.tryUpdate(AlterTableAddConstraint.java:108)
at 
org.h2.command.ddl.AlterTableAddConstraint.update(AlterTableAddConstraint.java:78)
at org.h2.engine.MetaRecord.execute(MetaRecord.java:60)
at org.h2.engine.Database.open(Database.java:842)
at org.h2.engine.Database.openDatabase(Database.java:319)
at org.h2.engine.Database.<init>(Database.java:313)
at org.h2.engine.Engine.openSession(Engine.java:69)
at org.h2.engine.Engine.openSession(Engine.java:201)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178)
at org.h2.engine.Engine.createSession(Engine.java:161)
at org.h2.engine.Engine.createSession(Engine.java:31)
at 
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:169)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:148)
at org.h2.Driver.connect(Driver.java:69)
at 
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
... more
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "FRUITS" not 
found; SQL statement:
ALTER TABLE PUBLIC.FRUITS ADD CONSTRAINT PUBLIC.CONSTRAINT_23 PRIMARY 
KEY(ID) INDEX PUBLIC.PRIMARY_KEY_23 [42102-199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:451)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
... 80 more

This isn't related to switching versions, I just recreated it to get the 
logs on the wrong version.

On Thursday, 4 February 2021 at 15:22:14 UTC Evgenij Ryazanov wrote:

> Hello.
>
> Error code 42102-200 is from H2 1.4.200, you should not try to use both 
> 1.4.199 and 1.4.200 with the same database file.
>
> If you have a database with corrupted metadata, you can add
> ;DATABASE_EVENT_LISTENER='path.to.Listener'
> to the connection url, where path.to.Listener is a fully-qualified class 
> name.
> Your class must implement org.h2.api.DatabaseEventListener and it needs 
> public no-arg constructor.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/80f54b45-f633-499a-82f0-feee0fa40c9bn%40googlegroups.com.

Reply via email to