Re: Statement.executeQuery() and no results

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Sailesh Krishnamurthy <sailesh(at)cs(dot)berkeley(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Statement.executeQuery() and no results
Date: 2003-07-23 03:01:33
Message-ID: 20030723030133.GN31669@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, Jul 22, 2003 at 07:48:49PM -0700, Sailesh Krishnamurthy wrote:
>
> Folks
>
> When we run a query that produces no results, executeQuery() returns
> an exception instead of a ResultSet object for which the first call to
> next() returns false. (This is with a driver for pgsql 7.3.2)

JDBC distinguishes between statements that return a (possibly empty)
ResultSet (e.g. any SELECT) that should use executeQuery() and statements
that return no ResultSet (e.g. INSERT or CREATE TABLE) that should use
executeUpdate().

The JDBC javadoc is a bit clearer than the driver's javadoc on this.

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joe Conway 2003-07-23 03:21:44 Re: the IN clause saga
Previous Message Kris Jurka 2003-07-23 02:59:49 Re: the IN clause saga