JDBC driver

To use a JDBC driver to connect to a database directly in a Spring Boot application, we will need to add the following dependencies to the pom.xml file:

<dependencies>  ...  <dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-jdbc</artifactId>  </dependency>  <dependency>    <groupId>mysql</groupId>    <artifactId>mysql-connector-java</artifactId>  </dependency></dependencies>

With the spring-boot-starter-jdbc module, Spring Boot will spin up an instance of javax.sql.DataSource and make it available as a bean in the Spring container. It will also configure a database connection pool. The mysql-connector-java library is the JDBC driver for MySQL database and you can see why we didn't specify <version> ...

Get Building Applications with Spring 5 and Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.