Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 97397 invoked from network); 28 Sep 2006 15:37:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Sep 2006 15:37:43 -0000 Received: (qmail 2210 invoked by uid 500); 28 Sep 2006 15:37:42 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 2179 invoked by uid 500); 28 Sep 2006 15:37:42 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 2170 invoked by uid 99); 28 Sep 2006 15:37:42 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2006 08:37:42 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:45069] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 63/C4-17533-54CEB154 for ; Thu, 28 Sep 2006 08:37:41 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 889317141D1 for ; Thu, 28 Sep 2006 15:33:50 +0000 (GMT) Message-ID: <14096384.1159457630541.JavaMail.jira@brutus> Date: Thu, 28 Sep 2006 08:33:50 -0700 (PDT) From: "Andrew McIntyre (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1896) Using 2 digit parameter numbers in queries defined using new Java 1.6 SQL query annotations fails. In-Reply-To: <25470244.1159448570138.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1896?page=comments#action_12438467 ] Andrew McIntyre commented on DERBY-1896: ---------------------------------------- Agreed, this is definitely a Mustang bug. Jeff, The numbers after the parameter markers in the text of the sql for the update annotation are markers for Sun's QueryObjectGenerator to map the fields in your addPerson method into the PreparedStatement that it sends to Derby. Numbers after parameter markers are not valid SQL syntax for Derby, so the QueryObjectGenerator in Mustang should be stripping these out, since they only have meaning to the QOG. It appears that the QOG correctly strips out the first digit but not a two-digit number, since the Derby parse error occurs on the zero. > 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.(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.(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