1

I'm trying to use h2 database in a springboot project, and i'm HikariDataSource, and i'm getting the following excepetion:

java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:h2:~/test
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:88) ~[HikariCP-2.4.7.jar:na]
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:298) ~[HikariCP-2.4.7.jar:na]
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:91) ~[HikariCP-2.4.7.jar:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:101) ~[HikariCP-2.4.7.jar:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:94) ~[HikariCP-2.4.7.jar:na]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProvide...:122) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at...

I think that my pom.xml and my configuration class are correct

url: jdbc:h2:~/test driverClassName: org.h2.Driver

Any clue on what i'm doing wrong?

3
  • Are you using it for testing purposes? Commented Jan 24, 2018 at 4:00
  • Is there some root cause exception in your log? Such as ClassNotFoundException or some security exception? Commented Jan 24, 2018 at 5:10
  • I'm getting only that exception "No suitable driver found", i'm following this tutorial: websystique.com/spring-boot/… and i also tried to use the source code provided by the author and i got the same error Commented Jan 24, 2018 at 11:24

2 Answers 2

2

Add driver in your pom.xml

<dependency>
 <groupId>com.h2database</groupId>
 <artifactId>h2</artifactId>
</dependency>

https://dzone.com/articles/integrate-h2-database-in-your-spring-boot-applicat

Sign up to request clarification or add additional context in comments.

1 Comment

I already did that, i'm following this tutorial: websystique.com/spring-boot/… i tried with the source code of author and got same error
0

Set the driver class name in the configuration for the pool.

1 Comment

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.