Re: Moving from PHP to Java: A result was returned when none was expected.

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Moving from PHP to Java: A result was returned when none was expected.
Date: 2016-06-15 14:21:47
Message-ID: CAADeyWj+6eAVCmaZRK3NSnLu5GZQ1u-ZLHNyKwafHU3_+4MMhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Jan,

On Wed, Jun 15, 2016 at 4:17 PM, Jan de Visser <jan(at)de-visser(dot)net> wrote:

> On Wednesday, June 15, 2016 3:56:07 PM EDT Alexander Farber wrote:
> > Now I am trying to call the same function through JDBC driver
> 9.4.1208.jre7:
> >
> > private static final String SQL_SKIP_GAME =
> > "SELECT words_skip_game(?, ?)";
> >
> > try (PreparedStatement st =
> > mDatabase.prepareStatement(SQL_SKIP_GAME)) { st.setInt(1, mUid);
> > st.setInt(2, gid);
> > st.executeUpdate();
> > }
> >
> > and sadly get the SQLException "A result was returned when none was
> > expected.".
> >
>
> Looking at the 9.4 documentation, I see something completely different:
>
> https://jdbc.postgresql.org/documentation/94/callproc.html
>
>
your doc talks about calling stored functions which return SETOF or cursor.

But my function is returning VOID, so according to
https://jdbc.postgresql.org/documentation/94/update.html
I was thinking I should call executeUpdate()?

Regards
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan de Visser 2016-06-15 14:30:11 Re: Moving from PHP to Java: A result was returned when none was expected.
Previous Message Jan de Visser 2016-06-15 14:17:24 Re: Moving from PHP to Java: A result was returned when none was expected.