db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-501) Client and embedded drivers differ on invoking a procedure that returns a single Dynamic resultSet using CallableStatement.executeQuery()
Date Mon, 22 Aug 2005 19:04:08 GMT
    [ http://issues.apache.org/jira/browse/DERBY-501?page=comments#action_12319634 ] 

Daniel John Debrunner commented on DERBY-501:
---------------------------------------------

I don't think executeQuery() is correct,. a definition of a single result set does not preclude
the procedure returning one or more update counts, which cannot be handled by  executeQuery.
Even though Derby doesn't support upfates counts with procedures it might in the future.

The code in 13.3.3.1 (also in JDBC 3) is an example, not part of the spec. We don't see how
the called function/procedure GETINFO is defined, maybe in that system it is defined to only
return a single result set and no update counts. 13.3.3.1 is only true if it is guaranteed
that the statement only returns a single result set, I don't see how in Derby that guarantee
can be made.

Section 13.3.3.3 is the true case (I believe here) quote:

'If the type or number of results returned by a CallableStatement object are not
known until run time, the CallableStatement object should be executed with the
method execute'

Note, 'type or number of results', not number of result sets.

> Client and embedded drivers differ on invoking a procedure that returns a single Dynamic
resultSet using CallableStatement.executeQuery()
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-501
>          URL: http://issues.apache.org/jira/browse/DERBY-501
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.1, 10.1.1.0
>  Environment: All Platforms
>     Reporter: Satheesh Bandaram
>  Attachments: Test.java, Test1.java
>
> It is possible to invoke a stored procedure that returns a single dynamic result using
CallableStatement.executeQuery using Derby Client. The embedded JDBC driver, however, throws
an exception like:
> Test starting ...url = jdbc:derby:tdb
> Exception in thread "main" ERROR X0Y78: Statement.executeQuery() cannot be called with
a statement that returns a row count.
>         at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:301)
>         at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:434)
>         at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1142)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1323)
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.executeStatement(EmbedCallableStatement.java:109)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java:241)
>         at Test1.main(Test1.java:26)
> I think the embedded driver behavior is incorrect here, though I would double check that
the JDBC spec says. 
> To reproduce the problem,
> 1) Create a database called 'tdb' and a table called COMPANY as create table COMPANY(name
char(10));
> 2) Insert two rows as: insert into COMPANY values 'IBM', 'SUN';
> 3) register a procedure as:
> CREATE PROCEDURE GETALLCOMPANIES() PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA
DYNAMIC RESULT SETS 1 EXTERNAL NAME 'Test.getAllCompanies'
> 4) Set server classpath
> 5) Compile two attached java programs, Test and Test1
> 6) Execute 'java Test1 1' to run as a client program and 'java Test1 2' to run as an
embedded program.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message