H2 version change issue from 1.4.200 to 2.0.202? - spring

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.

Related

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

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.

Spring Batch Meta-Data Schema for Oracle

Where can I found the sql to create in my database all the metadata sctructures needed by The Spring Batch framework.
The application don't have the permission on the database to outgenerate them.
As suggested in the documentation I've try to use the sql provided in the org.springframework.batch.core repository
but it's seems to be uncomplete.
For example it misses the column BATCH_JOB_EXECUTION .JOB_CONFIGURATION_LOCATION VARCHAR(2500), which on the other hand it's present in the documentation snippet
I've understand that this structure comes with the newest vesion 4.1 but also the (migration script)[https://github.com/spring-projects/spring-batch/blob/main/spring-batch-core/src/main/resources/org/springframework/batch/core/migration/4.1/migration-oracle.sql] doesn't seem to be right since it supposed that the column it's already there:
ALTER TABLE BATCH_JOB_EXECUTION MODIFY JOB_CONFIGURATION_LOCATION VARCHAR2(2500 char);
Where can I found the complete oracle sql script that creates the structure needed by the framework version 4.3.6 ?
If you look at https://github.com/spring-projects/spring-batch/blob/4.3.x/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-oracle10g.sql you can see the BATCH_JOB_EXECUTION.JOB_CONFIGURATION_LOCATION column. So you can use /org/springframework/batch/core/schema-oracle10g.sql from the classpath since it is included in spring-batch-core-4.3.6.jar.

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.

Spring boot - h2 and Oracle no 100% compatibility

I am using H2 in Spring boot app and Oracle DB on production.
For checking migration files I use FlyWay.
Unfortunately, H2 isn't compatible with Oracle (even if is set Oracle mode).
So, I can't validate my migrations files.
When I have a H2 query - validation in my project is ok, but when I upload it to production - it won`t work on Oracle.
Have you got any ideas how can I validate oracle migration files on my h2-db project?
The Flyway FAQ covers this under db specific SQL:
You can use the flyway.locations property. It would look like this:
TEST (Derby): flyway.locations=sql/common,sql/derby
PROD (Oracle): flyway.locations=sql/common,sql/oracle
You could then have the common statements (V1__Create_table.sql) in common and different copies of the DB-specific statements (V2__Alter_table.sql) in the db-specific locations.
Another approach if the differences are really minor ie only a few keywords, would be to have the keywords that differ as Flyway placeholders:
ALTER TABLE table_name ${alter_column} COLUMN column_name datatype;
TEST (H2): flyway.placeholders.alter_column=ALTER
PROD (Oracle): flyway.placeholders.alter_column=MODIFY

HSQLDB ROWNUM compatibility with Oracle

THe HSQLDB changelog states that ROWNUM() was added in v2.2.0 which I am using without any problems when running integration tests against the in-memory HSQLDB.
However I want to run the same tests against a real Oracle 10g database, but the query fails because the pseudo-column is called ROWNUM. Is there an easy way write a single query string that works in both environments?
The ROWNUM() function is available by default in HSQLDB 2.2.x and later. If you enable Oracle syntax compatibility mode, you can also use ROWNUM.
This statement enables it:
SET DATABASE SQL SYNTAX ORA TRUE
Or use the connection property sql.syntax_ora=true

Resources