javadatabasejsppostgresqlsql-insert

No results returned by the Query error in PostgreSQL


I am trying to insert a data into a table. After executing the query i am getting an exception stating

org.postgresql.util.PSQLException: No results were returned by the query.
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:284)

The data is getting inserted successfully, but i have no idea why i am getting this exception ??


Solution

  • Use

    executeUpdate
    

    instead of

    executeQuery
    

    if no data will be returned (i.e. a non-SELECT operation).