db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-522) ERROR X0Y79 raised when adding comments using "--" before sql queries with Network Client
Date Fri, 19 Aug 2005 22:27:54 GMT
     [ http://issues.apache.org/jira/browse/DERBY-522?page=all ]

Kathey Marsden updated DERBY-522:
---------------------------------

        Summary: ERROR X0Y79 raised when adding comments using "--" before sql queries with
Network Client  (was: ERROR X0Y79 raised when adding comments using "--" before sql queries
with Network Cleint)
    Description: 
Comments before a  select statement Throws exception with Network Client
For Example a statement like the one below in the attached program with throw an exception.

stmt.execute("-- This is a comment \n Select c11 from TAB1");



org.apache.derby.client.am.SqlException: Statement.executeUpdate() cannot be called with a
statement that returns a ResultSet.
        at org.apache.derby.client.am.Statement.completeSqlca(Statement.java:1354)
        at org.apache.derby.client.am.Statement.completeExecuteImmediate(Statement.java:964)
        at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(NetStatementReply.java:199)
        at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(NetStatementReply.java:50)
        at org.apache.derby.client.net.StatementReply.readExecuteImmediate(StatementReply.java:44)
        at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(NetStatement.java:123)
        at org.apache.derby.client.am.Statement.readExecuteImmediate(Statement.java:960)
        at org.apache.derby.client.am.Statement.flowExecute(Statement.java:1587)
        at org.apache.derby.client.am.Statement.executeX(Statement.java:631)
        at org.apache.derby.client.am.Statement.execute(Statement.java:622)
        at CommentBeforeSelect.createAndPopulateTable(CommentBeforeSelect.java:70)
        at CommentBeforeSelect.main(CommentBeforeSelect.java:35)
$
To reproduce run the attached program 
java CommentBeforeSelect


  was:

	//  Bug 5398 -   comments in select statement Throws exception
	stmt.execute("-- This is a comment \n Select c11 from TAB1");
	ResultSet rs = stmt.getResultSet();


The problem comes I think because the client looks at the SQL statement and sends it as  EXCSQLIMM
,  because it does not  start with SELECT, VALUES, etc.
EXCSQLIMM cannot be used for a statement that returns result sets.

Client needs to treat the statement as a select and handle it properly.

Note:
Currently IJ currently has code to strip out the comments for Network Client so the issue
will not reproduce with IJ.




> ERROR X0Y79 raised when adding comments using "--" before sql queries with Network Client
> -----------------------------------------------------------------------------------------
>
>          Key: DERBY-522
>          URL: http://issues.apache.org/jira/browse/DERBY-522
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions: 10.1.1.0, 10.2.0.0, 10.1.1.1
>     Reporter: Kathey Marsden

>
> Comments before a  select statement Throws exception with Network Client
> For Example a statement like the one below in the attached program with throw an exception.
> stmt.execute("-- This is a comment \n Select c11 from TAB1");
> org.apache.derby.client.am.SqlException: Statement.executeUpdate() cannot be called with
a statement that returns a ResultSet.
>         at org.apache.derby.client.am.Statement.completeSqlca(Statement.java:1354)
>         at org.apache.derby.client.am.Statement.completeExecuteImmediate(Statement.java:964)
>         at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(NetStatementReply.java:199)
>         at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(NetStatementReply.java:50)
>         at org.apache.derby.client.net.StatementReply.readExecuteImmediate(StatementReply.java:44)
>         at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(NetStatement.java:123)
>         at org.apache.derby.client.am.Statement.readExecuteImmediate(Statement.java:960)
>         at org.apache.derby.client.am.Statement.flowExecute(Statement.java:1587)
>         at org.apache.derby.client.am.Statement.executeX(Statement.java:631)
>         at org.apache.derby.client.am.Statement.execute(Statement.java:622)
>         at CommentBeforeSelect.createAndPopulateTable(CommentBeforeSelect.java:70)
>         at CommentBeforeSelect.main(CommentBeforeSelect.java:35)
> $
> To reproduce run the attached program 
> java CommentBeforeSelect

-- 
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