db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Ash (JIRA)" <derby-...@db.apache.org>
Subject [jira] Created: (DERBY-1896) Using 2 digit parameter numbers in queries defined using new Java 1.6 SQL query annotations fails.
Date Thu, 28 Sep 2006 13:02:50 GMT
Using 2 digit parameter numbers in queries defined using new Java 1.6 SQL query annotations
fails.
--------------------------------------------------------------------------------------------------

                 Key: DERBY-1896
                 URL: http://issues.apache.org/jira/browse/DERBY-1896
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.1.3.1
         Environment: Windows XP Professional
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)
            Reporter: Jeff Ash


The first part of this message is Sun's response.  The other section below has my description
sent to Sun originally:

Thank you for reporting this issue.

Please ask the developers of Apache Derby to investigate this issue further.  Since the JDBC
parser of Derby appears to trigger this failure, the developers of Derby will be able to examine
their product, isolate the cause of the behavior, and, if necessary, provide us with a detailed
report.

We greatly appreciate your efforts in identifying areas in the J2SE where we can improve upon
and I would request you to continue doing so.

Regards,
Nelson

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: This message, including any attachments, is for the intended
recipient(s) only.  If you are not the intended recipient(s), please
reply to the sender, delete this message, and refrain from disclosing,
copying, or distributing this message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------- Previous Messages ----------------


--------------------- Report ---------------------

     category : java
  subcategory : jdbc
      release : mustang
         type : bug
     synopsis : Using 2 digit parameter numbers in queries defined using annotations fails.
customer name : Jay
customer mail : jash@ministryinnovation.com
       sdn id :
     language : en
      company : Ministry Innovation
     hardware : x86
           os : win_xp
       bug id : 0
 date created : Thu Sep 14 10:25:35 MST 2006
date evaluated : Thu Sep 28 04:51:27 MST 2006
  description :
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Using 2 digit parameter numbers in queries defined using annotations fails.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
@Update (sql="INSERT INTO app.person (first_name, last_name, middle_name, nickname, " +
                "title, suffix, sex, birth_date, work_phone1, work_phone2) " +
                "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, " +
                "        ?9, ?10)")
   public int addPerson(
       String p_firstName, String p_lastName, String p_middleName,
       String p_nickname, String p_title, String p_suffix, String p_sex,
       Date p_birthDate, String p_workPhone1, String p_workPhone2);

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful execution
ACTUAL -
End result is a parse error from the RDBMS (Derby).    Through testing I've determined that
the JDBC parser that determines parameter numbers only looks at the first character after
the ?.  It tries to parse this as the number.  When you use an invalid character after the
? (say, a letter), you get a NumberFormatException (expected).  However, if you put 2 letters,
you only get the exception mentioning the first of the two characters.  Obviously, it is not
checking for multiple digit numbers for the parameters.  This is why an incorrect SQL statement
is being passed to the DBMS engine.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
ERROR 42X01: Syntax error: Encountered "0" at line 1, column 242.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at com.sun.sql.QueryObjectGeneratorImpl.getUpdateImpl(QueryObjectGeneratorImpl.java:469)
at com.sun.sql.QueryObjectGeneratorImpl.access$200(QueryObjectGeneratorImpl.java:24)
at com.sun.sql.QueryObjectGeneratorImpl$3.run(QueryObjectGeneratorImpl.java:231)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.sql.QueryObjectGeneratorImpl.invoke(QueryObjectGeneratorImpl.java:226)

REPRODUCIBILITY :
This bug can be reproduced always.

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