No suitable driver found for jdbc:h2:tcp

后端 未结 2 1677
执念已碎
执念已碎 2021-01-19 14:11

an java.sql.SQLException: No suitable driver found for jdbc:h2:tcp://localhost/~/ZadatakDB is thrown when I try to connect to h2 database using a java web application.

相关标签:
2条回答
  • 2021-01-19 14:35

    The JDBC driver for the H2 database is not in the classpath, or the driver is is unloaded. Use this to load the driver class:

    Class.forName("org.h2.Driver");
    
    0 讨论(0)
  • 2021-01-19 14:43

    For a maven project ensure that <scope> of com.h2database dependency is not set to test. I removed the scope completely for my dependency and the issue was resolved.

    0 讨论(0)
提交回复
热议问题