Re: JDBC - Mailing list pgsql-jdbc

From David G. Johnston
Subject Re: JDBC
Date
Msg-id CAKFQuwZJ8qLvKyX-JrFbysjHuWSDDFaMpbjXTGe-zhtOkDn2JA@mail.gmail.com
Whole thread Raw
In response to Re: JDBC  (Chuck Davis <cjgunzel@gmail.com>)
Responses Re: JDBC
List pgsql-jdbc
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.


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: Chuck Davis
Date:
Subject: Re: JDBC
Next
From: Chuck Davis
Date:
Subject: Re: JDBC