Skip site navigation (1) Skip section navigation (2)

RE: Why?? executeQuery() & exception: "No results were returned by the query."

From: Joe Shevland <J(dot)Shevland(at)eclipsegroup(dot)com(dot)au>
To: "'Panu Outinen'" <panu(at)vertex(dot)fi>, "'pgsql-jdbc(at)postgresql(dot)org'" <pgsql-jdbc(at)postgresql(dot)org>
Subject: RE: Why?? executeQuery() & exception: "No results were returned by the query."
Date: 2001-05-08 22:37:52
Message-ID: C56487636E5CD4119B1E00D0B789098AC96868@MEL-EXCH1 (view raw or flat)
Thread:
Lists: pgsql-jdbc
In all the years I've been using the PostgreSQL JDBC driver I haven't
spotted this problem; resultset.next() should just return 'false' if there
are no more rows to retrieve... unless this is caused by executing a
'non-query' i.e. executing an insert/update/delete statement in
sment.executeQuery().

Cheers,
Joe


> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Panu Outinen
> Sent: Wednesday, 9 May 2001 12:05 AM
> To: pgsql-jdbc(at)postgresql(dot)org
> Subject: [JDBC] Why?? executeQuery() & exception: "No results were
> returned by the query."
> 
> 
> Hi there !
> 
> Can anyone explain why does executeQuery() throws an exception
> "No results were returned by the query."
> when result set is empty ???????
> 
> In my opinion (and also e.g. Oracle's JDBC driver's opinion) 
> that this is 
> just normal and user can check the number of rows (=0) that none was 
> returned. It's totally different to make a query where 
> something is wrong 
> in the query itself e.g. non-existant column is used or 
> perhaps in the 
> database connection!
> 
> This is "pain in the *ss" to test against in one's code for 
> every different 
> JDBC driver's DIFFERENT return string there available and 
> it's impossible 
> to do code that works for even unknown drivers. And 
> Postgresql has even 
> language dependant versions of this !!!
> 
> Since Postgresql source code is so nicely publicly available 
> (thank you all 
> there!) and thus improvements are easily given by anyone I 
> just wonder if 
> this could be improved, please !!!
> 
>    - Panu
> 
> PS. I know for sure that at least SQL Server throws the 
> following when used 
> through JDBC-ODBC bridge: "No ResultSet was produced".
> 
> 
> ----------------------------------------------------------------------
> 
> org\postgresql\jdbc2\Statement.java:
> 
> ...
> 	/**
> 	 * Execute a SQL statement that retruns a single ResultSet
> 	 *
> 	 * @param sql typically a static SQL SELECT statement
> 	 * @return a ResulSet that contains the data produced 
> by the query
> 	 * @exception SQLException if a database access error occurs
> 	 */
> 	public java.sql.ResultSet executeQuery(String sql) 
> throws SQLException
> 	{
> 	    this.execute(sql);
> 	    while (result != null && 
> !((org.postgresql.ResultSet)result).reallyResultSet())
> 		result = ((org.postgresql.ResultSet)result).getNext();
> 	    if (result == null)
> 		throw new PSQLException("postgresql.stat.noresult");
> 	    return result;
> 	}
> ...
> 
> ----------------------------------------------------------------------
> 
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
> 

pgsql-jdbc by date

Next:From: Bruce MomjianDate: 2001-05-08 22:43:45
Subject: Re: Re: Outstanding patches
Previous:From: Tim BarnardDate: 2001-05-08 22:29:27
Subject: Re: A different compile problem for 7.1.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group