Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YQ4-0000M7-Vr for pgsql-jdbc@arkaria.postgresql.org; Wed, 04 Sep 2019 16:46:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5YQ2-0005fH-GT for pgsql-jdbc@arkaria.postgresql.org; Wed, 04 Sep 2019 16:46:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YQ2-0005f9-8P for pgsql-jdbc@lists.postgresql.org; Wed, 04 Sep 2019 16:46:06 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5YPy-0006en-Qf for pgsql-jdbc@lists.postgresql.org; Wed, 04 Sep 2019 16:46:05 +0000 Received: by mail-pf1-x444.google.com with SMTP id q5so5741461pfg.13 for ; Wed, 04 Sep 2019 09:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=5c9UpGqLaQ3ixKYy5vj6n17IpVLdRt8v4hUkcm63BRQ=; b=GORzFrJB2Jcc0Gvv1/uuvQBUnErIIWRKzavNJdZgnvBhnQmE/Qh2h9qbnvH0FmAqy7 /Usjz4HYCH/kNdjbi2/Zf1bhDvNepvkknHlZ+TS2zPaSSLFRVvEfXESmLF7Jjg2kVeZu f9G23CvGH5gcju/pcnK/ogvZauY1f5JsFuJqi7v1XGjG5hkVE9LiM8ou9WnLsFKKh0j/ NekfCzqLXiBi2iIgIrVIMtbYYW0MsCRCTl0e56HSyy5vWdPuARBoEkqgm2cyWviDoS62 5RlsVPSq/v5FhxpUEeaXcWSseTlLZQ36ymNX0sqkIAmxAyrLwxaWexcQJlPB3zrDGVDT 4ofw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=5c9UpGqLaQ3ixKYy5vj6n17IpVLdRt8v4hUkcm63BRQ=; b=NtumVROgb39fV9z3a/5xNds5yJlHiFekLdoXpiWcEk05zQ5Y/BKZ0pFdvT6Yd3Pxzj kvMcaCz2nB9uWd0qZRqGkRJS3YvGEhgjCFU4syBVVvS3e8kOlUcpGQm0/q0t8zTQq67O D9nEB1dfOPdSxlZC0BpFb2N8PEB2QERCa+1IQXkYiAz3pLrGjqTe2zV5ByiRxhFcVyWx 6n81Hm8HpP6hmqoG2tweORzgp9eAVv+Xvb+CVCwILayVNXF6W0AqQKDGO9J4mDJSCEhO h00k7oNoeq+RRDgQRvoR2mnruXdQFE/OUVKoqLHnoHgIHmBQ+AGczMJyXTyjmukJBY+n UF7w== X-Gm-Message-State: APjAAAUoLS+VU60uzf85bIszDX7YU1Jr3hMqPviC6uBF+MRqLj++IXo+ wgmWSv9Ri+q5RjeDpSCHPZI= X-Google-Smtp-Source: APXvYqxdygSjv6D9kpYwoEQy+R3BCOnQ42NDB7TTID1dasHPs+mDBSCAILJDhD4TXfmnXPi0HG6Yww== X-Received: by 2002:a17:90a:1150:: with SMTP id d16mr6182333pje.2.1567615151603; Wed, 04 Sep 2019 09:39:11 -0700 (PDT) Received: from [10.106.130.64] ([155.100.47.0]) by smtp.gmail.com with ESMTPSA id l7sm21203586pff.35.2019.09.04.09.39.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Sep 2019 09:39:11 -0700 (PDT) From: Rob Sargent Message-Id: <1EC7278E-6842-4269-BCED-4238EFFF6562@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_312211D3-4D0E-48A7-B9BA-C8C5020DE75D" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next. Date: Wed, 4 Sep 2019 10:39:09 -0600 In-Reply-To: <9b008bfa3107e8a3f7505b6f300237d1e13eff7f.camel@gmail.com> Cc: Karen Goh , pgsql-jdbc@lists.postgresql.org, Mark Rotteveel To: rob stone References: <932079842.712590.1567405714491@mail.yahoo.com> <58285538-686D-45F6-B5A5-883DBE7D0C10@gmail.com> <1422030722.958511.1567487705474@mail.yahoo.com> <1ACDE5B3-3F0E-4BF0-8C37-DAD09F35F30C@gmail.com> <860006402.1322813.1567568281784@mail.yahoo.com> <1829430979.1362196.1567576711470@mail.yahoo.com> <8b79560c-3108-af04-e74f-f4fb55aa0624@lawinegevaar.nl> <1705600642.1365952.1567582413285@mail.yahoo.com> <9b008bfa3107e8a3f7505b6f300237d1e13eff7f.camel@gmail.com> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_312211D3-4D0E-48A7-B9BA-C8C5020DE75D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > As I said last time, I'm not an "expert". >=20 > subjectNames is declared as an array. > In your "for" loop you will be doing ps2.setArray(2, array); multiple > times depending on the number of subjects contained in subjectNames. >=20 > I suspect the query is failing and as there is no try .. catch block = to > trap the SQLException, this is not reported back to your code. >=20 > If you alter the postgresql.conf to log all SQL statements, restart, > run your test again, look in the log file, it will show the passed > parameter values. You can then verify that that the array passed as = the > second parameter is correct. >=20 > HTH, > Robert Relieved am I that other=E2=80=99s could see that I was not doubting the = OP wrote the code in question. I do consider myself a Java programmer = (expert is a trickier question). We do need to see the entire routine (I think that might be doPost()). = If that=E2=80=99s more than 100 lines I suggest a refactor first. Have = the doPost() call a method which does nothing but the desired = interaction.=20= --Apple-Mail=_312211D3-4D0E-48A7-B9BA-C8C5020DE75D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
As I said = last time, I'm not an "expert".

subjectNames is declared as an array.
In your "for" = loop you will be doing ps2.setArray(2, array); multiple
times = depending on the number of subjects contained in subjectNames.

I suspect the = query is failing and as there is no try .. catch block to
trap the = SQLException, this is not reported back to your code.

If you alter = the postgresql.conf to log all SQL statements, restart,
run your test = again, look in the log file, it will show the passed
parameter = values. You can then verify that that the array passed as the
second = parameter is correct.

HTH,
Robert
Relieved am I that = other=E2=80=99s could see that I was not doubting the OP wrote the code = in question.  I do consider myself a Java programmer (expert is a = trickier question).

We= do need to see the entire routine (I think that might be doPost()). =  If that=E2=80=99s more than 100 lines I suggest a refactor first. = Have the doPost() call a method which does nothing but the desired = interaction. 
= --Apple-Mail=_312211D3-4D0E-48A7-B9BA-C8C5020DE75D--