Re: JDBC - Mailing list pgsql-jdbc

From Chuck Davis
Subject Re: JDBC
Date
Msg-id CAHf=Y_aQBSRSSK+8Xrw=7Ak4nkUg1T-JRa80LLOFOgPrsCfG7A@mail.gmail.com
Whole thread Raw
In response to Re: JDBC  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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.g.johnston@gmail.com> wrote:
> On Sunday, June 10, 2018, Chuck Davis <cjgunzel@gmail.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.
>


pgsql-jdbc by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: JDBC
Next
From: Vladimir Sitnikov
Date:
Subject: [pgjdbc/pgjdbc] b7fd9f: fix: support query timeouts exceeding 2147483seco...