1

I'm trying to change the password of the non-admin user in PostgreSQL using jdbc connection.

statement.executeQuery("ALTER ROLE user1 WITH PASSWORD '6789'");

This above query is throwing:

org.postgresql.util.PSQLException: No results were returned by the query

How to resolve this issue?

halfer
  • 19,824
  • 17
  • 99
  • 186
dev333
  • 713
  • 2
  • 17
  • 38

1 Answers1

3

statement.executeQuery() expects a resultset and you don't get one. Use statement.execute() for an ALTER-statement to avoid this issue.

Link to the manual: https://jdbc.postgresql.org/documentation/head/ddl.html

Frank Heikens
  • 117,544
  • 24
  • 142
  • 135