I prescribe the following ones, but the idea is cursed by the driver - he writes that he cannot load it.

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.h2.JDBC"/> <property name="url" value="jdbc:h2:~/test"/> <property name="username" value=""/> <property name="password" value=""/> </bean> 
  • Do you have a driver? - Nikolay
  • how to find out? - Gennadyi
  • add to pom.xml? - Nikolay
  • and more - at what point does the idea swear? when building, running ...? - Nikolay
  • Swears at startup - Gennadyi

1 answer 1

You use the maven build system for the project.
To use third-party libraries (drivers) in maven, you need to specify them in dependencies in the pom file in the section:
<dependencies> your dependencies </ dependencies> .
For a particular H2DB database, you need to take the dependency connection strings by the link: org.h2.Driver .
After you add dependencies, you need to select the Maven Projects button on the right in IDEA, the Execute Maven Goal button there, in the opened window enter "clean package" (which would mean to clear the previous builds and rebuild). After that, all dependencies are installed in your local repository (by default% userhome% .m2 ...). And problems with dependencies will be resolved.

  • I tried, the same garbage was - Gennadyi
  • How do you build a project, is the jar itself with the driver connected? If maven or gradle here , if standard, then download and add jar manually from there. - ezhov_da
  • Maven is using. - Gennadyi
  • So connect the dependency, then clean the package and everything should work. - ezhov_da
  • What does clean package mean? - Gennadyi