Unsupported connection setting "MVCC" [90113-200] H2 database - h2

Does anyone know what could be the problem with the connection to the H2 database?
I didn't change anything in my project in terms of database config, and everything worked fine until yesterday.
Now, I cannot run my project locally because the connection craches.
These are the logs from the H2 console:

H2 1.4.197 was the last version of H2 with MVCC setting.
H2 1.4.198 Beta and H2 1.4.199 silently ignore this setting.
H2 1.4.200 and newer versions throw an exception on attempts to use it.
You need to remove ;MVCC=something from JDBC URL. Please also note that H2 1.4.200 is an old unsupported version of H2 database.

Related

H2 version change issue from 1.4.200 to 2.0.202?

I upgraded my springboot H2 dependency from 1.4.200 to 2.0.202 , but getting the below exception . Could you please help.
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException:
Syntax error in SQL statement "SELECT [*]VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME = 'MODE'"; expected "TOP, DISTINCT, ALL, *, INTERSECTS, NOT, EXISTS, UNIQUE, INTERSECTS"; SQL statement:
SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME = 'MODE' [42001-210]
INFORMATION_SCHEMA in H2 2.x.y is not compatible with INFORMATION_SCHEMA from H2 1.x.y.
You need to use
SELECT SETTING_VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE SETTING_NAME = 'MODE'
with new versions of H2.
If this query was executed by Flyway, you need to upgrade it to 8.2.2 or any newer version, older versions don't support recent versions of H2.
You also need to check versions of other libraries, for example, if you use Hibernate ORM, you need to upgrade it to 5.6.5.Final (or later version). Older versions also don't support H2 2.x.y.
Please also note that H2 2.0.202 is an old release with many new features and also many bugs and regressions, it will be better to use H2 2.1.210, it contains various important fixes.

JPA database indexes are not working properly in latest H2 (2.0.204)

I am trying to upgrade the H2 version from 1.4.200 to 2.0.204. BUt, in my view, the indexes are not working properly.
Steps:
Create Entity and Indexes from JPA layer as shown in below image.
SomeEntity.Java example
2. Default values in application.properties:
spring.datasource.url=jdbc:h2:file:./data/testDb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.h2.console.enabled=true
spring.h2.conso\le.path=/h2
Start the spring-boot application.
Till this step, everything should be fine and index should be created successfully.
Now, restart the service.
Here, H2 service ( especially,"CreateIndex.executeMeta") is trying to create the index (custom Index) again and failed.
Above steps are working fine in older versions (1.4.200 and below).
Anyone faced similar issue or do we have any workaround for this?
Thanks!!
There have been breaking changes in H2 with version 2.0. Some of the changed behavior can be changed back by using the legacy compatibility mode: http://www.h2database.com/html/features.html
Please try setting
spring.datasource.url=jdbc:h2:file:./data/testDb;MODE=LEGACY
If this does not help, you'll probably need wait with the upgrade until a compliant Hibernate version has been released. See e.g.:
https://hibernate.atlassian.net/browse/HHH-14985
https://hibernate.atlassian.net/browse/HHH-15002

Flyway start with version 1 if using H2 in memory DB

Using Flyway 4.0.1 H2 1.3 baselineOnMigrate=true. When i use H2:mem, flyway start with version 1 in his metadata table. It should start with empty version. When i use disk DB this is not heppening. Any idea?
It is because DB is accessed from diferent classloaders. Every classloader has its own DB. I need to use TCP connection. Details on: Local H2 Server-Client connection with DB running in memory

Wildfly using h2 for datasource instead of driver I specified

I added ojdbc6.jar driver to Wildfly as a deployment, and created a datasource which uses the ojdbc6.jar driver. This worked and I was able to access the database in my project - displaying info from the database using a servlet.
However when I restarted my computer it no longer worked (but I hadn't changed anything) and was throwing me org.h2.jdbc.JdbcSQLException even though I am not trying to connect to the h2 database.
So basically Wildfly seems to keep overwriting the setting for my Datasource to use the ojdbc6 driver and changing it to use the h2 driver and I don't know how to stop this.
Can anyone help?
I have seen online for this problem about editing a persistence.xml file but I don't have one.. should I create one?

Hibernate dialect Issues with update to Oracle 12.2 C database when using Grails

We are running Grails 2.3.11 on JRE 1.8_211. We have Hibernate version - 3.6.10.6.
When we were working with Oracle 11, it was working fine but when I upgrade to 12.2C, we get following error:-
org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [Oracle]!
On reverting back to Oracle 11, the issue gets resolved.
Can anyone please suggest a solution for migrating my application to Oracle 12.2C.
We had not specified the hibernate dialect in one of the datasources in datasource.groovy.
It seems that in oracle 12C, it is mandatory to specify the dialect for each data source even though it is not mandatory for Oracle 11g.
Hence, during migrating from Oracle 11g to Oracle 12C, please add verifying that dialects are explicitly specified in your checklist.
Hope this helps others.

Resources