Skip to content

Spring boot won’t connect to Postgres database

I am trying to learn Spring Boot with a tutorial. I have the code and the database, but I keep getting a Hibernate ERROR whenever I try to connect the two…

This is the Error I get:

 :: Spring Boot ::                (v2.7.2)

2022-08-04 19:23:59.263  INFO 13108 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1746 ms
2022-08-04 19:23:59.463  INFO 13108 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-08-04 19:24:00.560 ERROR 13108 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

I have the dependency set up in my pom.xml:



The StudentService

public class StudentService {
    public List<Student> getStudents() {
        return List.of(
                new Student(
                        LocalDate.of(2000, Month.JANUARY, 5),

And the StudentController class

@RequestMapping(path = "api/v1/student")
public class StudentController {

    private final StudentService studentService;

    public StudentController(StudentService studentService) {
        this.studentService = studentService;

    public List<Student> getStudents() {
        return studentService.getStudents();


Unfortunately I have no idea what’s the problem or what I can do to improve it. I googled, but only found “the password not filled in” (which is not the case) and “the not being in the resources folder” (which they are…)

Thank you so much already for looking through it and if I can clarify anything, I am happy to do so.

Edit: sorry for posting it as pictures I replaced everything but the error code if I should change that too just tell me

If I am correct, the version of the PostgreSQL is 14.4 the text from the pg_hba.config:

# PostgreSQL Client Authentication Configuration File
# ===================================================

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     scram-sha-256
# IPv4 local connections:
host    all             all               scram-sha-256
# IPv6 local connections:
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     scram-sha-256
host    replication     all               scram-sha-256
host    replication     all             ::1/128                 scram-sha-256



I fixed it by now. The problem was that I wrote hibernat instead of hibernate in the…

User contributions licensed under: CC BY-SA
7 People found this is helpful