Re: JDBC

From: Chuck Davis <cjgunzel(at)gmail(dot)com>
To:
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC
Date: 2018-06-11 01:33:32
Message-ID: CAHf=Y_aQBSRSSK+8Xrw=7Ak4nkUg1T-JRa80LLOFOgPrsCfG7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thanks David. That got me going. Getting the "false" value I expected.

On Sun, Jun 10, 2018 at 4:26 PM, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Sunday, June 10, 2018, Chuck Davis <cjgunzel(at)gmail(dot)com> wrote:
>>
>> If I try to return a ResultSet the class will not compile with the
>> message that boolean cannot be converted to a ResultSet. And this is
>> in synch with the documentation that states the "exists" subquery will
>> return a boolean -- not a ResultSet.
>>
>
> The PostgreSQL documentation doesn't talk in terms JDBC, the Oracle JDBC API
> specification covers that.
>
> https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html
>
> JDBC uses ResultSet to return the results of queries.
>
>>
>> There are a number of sites that indicate the statement is the way to
>> find out if a table exists. Are the sites for an older version of PG?
>> I'm running on 10.
>
>
> This really has nothing to do with PostgreSQL specifically, you are failing
> to use the JDBC API correctly. In the short term you should probably just
> use "executeQuery" instead of "execute" since you are in fact executing a
> query that returns a ReaultSet (which is exactly what execute's true boolean
> result is telling you).
>
> David J.
>

In response to

  • Re: JDBC at 2018-06-10 23:26:52 from David G. Johnston

Browse pgsql-jdbc by date

  From Date Subject
Next Message Alvaro Herrera 2018-06-15 20:23:28 Re: [HACKERS] Statement-level rollback
Previous Message David G. Johnston 2018-06-10 23:26:52 Re: JDBC