# Spring 3 Upgrade H2 Database error. Could not instantiate named strategy class \[org.hibernate.dialect.H2Dialect\]

**URL:** <https://discourse.hibernate.org/t/spring-3-upgrade-h2-database-error-could-not-instantiate-named-strategy-class-org-hibernate-dialect-h2dialect/10348>\
**Category:** Hibernate ORM\
**Created:** [September 19, 2024, 5:17am UTC](https://discourse.hibernate.org/t/spring-3-upgrade-h2-database-error-could-not-instantiate-named-strategy-class-org-hibernate-dialect-h2dialect/10348 "2024-09-19T05:17:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thilak\_a](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@thilak\_a](https://discourse.hibernate.org/u/thilak_a)\
**Post date:** [September 19, 2024, 5:17am UTC](https://discourse.hibernate.org/t/spring-3-upgrade-h2-database-error-could-not-instantiate-named-strategy-class-org-hibernate-dialect-h2dialect/10348/1 "2024-09-19T05:17:48Z")

</div>

Hi,

The following error is thrown when upgraded to Hibernate 6.x, H2 DB version 2.2.224

```auto
LogLevel="WARN" txnId="" "ThreadId="main" loggerName="o.h.e.j.e.i.JdbcEnvironmentInitiator" - HHH000342: Could not obtain connection to query metadata
org.hibernate.boot.registry.selector.spi.StrategySelectionException: Could not instantiate named strategy class [org.hibernate.dialect.H2Dialect]
.....

Caused by: java.lang.NumberFormatException: For input string: "19c"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[?:?]
	at java.lang.Integer.parseInt(Integer.java:668) ~[?:?]
	at java.lang.Integer.parseInt(Integer.java:786) ~[?:?]
	at org.hibernate.dialect.H2Dialect.parseBuildId(H2Dialect.java:168) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]
	at org.hibernate.dialect.H2Dialect.parseVersion(H2Dialect.java:156) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]
	at org.hibernate.dialect.H2Dialect.<init>(H2Dialect.java:128) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]

```

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [September 19, 2024, 7:55am UTC](https://discourse.hibernate.org/t/spring-3-upgrade-h2-database-error-could-not-instantiate-named-strategy-class-org-hibernate-dialect-h2dialect/10348/2 "2024-09-19T07:55:39Z")

</div>

Looks like you’re setting an explicit database version that is simply wrong or you are connecting to the wrong database with the `H2Dialect`.

---

<div class="post-metadata">

**Author:** ![thilak\_a](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@thilak\_a](https://discourse.hibernate.org/u/thilak_a)\
**Post date:** [September 21, 2024, 12:11pm UTC](https://discourse.hibernate.org/t/spring-3-upgrade-h2-database-error-could-not-instantiate-named-strategy-class-org-hibernate-dialect-h2dialect/10348/3 "2024-09-21T12:11:04Z")

</div>

@beikov Correct, I debugged and found it is connecting to Oracle Database version 19c. This issue is occurring after I upgrade to Spring 3, hibernate 6. I am trying to figure out how to override the config properties with test properties from resource file. Any how, thanks for the reply.
