Dmitry Bakhtiarov
Dmitry Bakhtiarov

Reputation: 393

Can not connect from spring boot to postgresql schema - 'org.postgresql.util.PLSQLException: ERROR: schema "test" does not exist'

I have postgresql database, version 11. There I created database schema 'test'. Sql of that schema:

CREATE SCHEMA TEST
AUTHORIZATION "user-xxx";
ALTER DEFAULT PRIVILEGES IN SCHEMA test
GRANT ALL ON TABLES TO postgres;
ALTER DEFAULT PRIVILEGES IN SCHEMA test
GRANT ALL ON TABLES TO PUBLIC;

My config in spring boot:

datasource:
  platform: postgres
  jdbc-url: jdbc:postgresql://localhost:5432/BDA
  username: user-xxx
  password: user-xxx
jpa:
  generate-ddl: true
  properties:
    hibernate:
      default_schema: TEST

When launching the application I always get following exception:

Can not connect from spring boot to postgresql schema - 'org.postgresql.util.PLSQLException: ERROR: schema "test" does not exist'

If I don't specify the schema then it works with default database schema, and everything is ok.

Upvotes: 0

Views: 1326

Answers (1)

Dmitry Bakhtiarov
Dmitry Bakhtiarov

Reputation: 393

I fond the reason. When jpa driver connects to PostgreSQL schema 'TEST' it lowercase the letters, and searches for 'test'. So, I renamed the schema to 'test', and the configuration setting to 'test', and was able to connect then.

Upvotes: 1

Related Questions