© Marten Deinum 2018
Marten DeinumSpring Boot 2 Recipeshttps://doi.org/10.1007/978-1-4842-3963-6_7

7. Data Access

Marten Deinum1 
(1)
Meppel, Drenthe, The Netherlands
 

When working with a database the first thing you need is a connection to the database. A connection in Java is obtained through a javax.sql.DataSource. Spring provides out-of-the-box several implementations of a DataSource like the DriverManagerDataSource and SimpleDriverDataSource . However, these implementations aren’t connections pool and should be considered mainly for testing but not production use. For a live system, you want to use a proper connection pool like HikariCP.1

Tip

In the db folder there is a Dockerfile that will build a PostgreSQL2 with the database automatically ...

Get Spring Boot 2 Recipes: A Problem-Solution Approach 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.