I have PostgreSQL database form there I have created database and user using below commands.
create database webreporting;
create user csr with password 'csrtest12!@';
grant all on database webreporting to csr;
GRANT ALL PRIVILEGES ON ALL TABLES
IN SCHEMA public to csr;
GRANT ALL PRIVILEGES ON ALL TABLES IN
SCHEMA public TO csr;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN
SCHEMA public TO csr;
I am trying connect this database from springboot application. Spring boot application is started successfully but while executing the query from application it's throwing exception like below
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [Delete from facts where customer_id=?]; nested exception is
org.postgresql.util.PSQLException: ERROR: permission denied for table facts.
Application.properties file is:
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/webreporting
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.username=csr
spring.datasource.password=csrtest12!@
I am not sure why I am getting permission denied exception.
ALTER ROLE <username> WITH LOGIN;