Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 46736 invoked from network); 28 Sep 2006 13:08:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Sep 2006 13:08:11 -0000 Received: (qmail 80988 invoked by uid 500); 28 Sep 2006 13:08:11 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80953 invoked by uid 500); 28 Sep 2006 13:08:10 -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 80944 invoked by uid 99); 28 Sep 2006 13:08:10 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2006 06:08:10 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2916A7141E0 for ; Thu, 28 Sep 2006 13:02:50 +0000 (GMT) Message-ID: <25470244.1159448570138.JavaMail.jira@brutus> Date: Thu, 28 Sep 2006 06:02:50 -0700 (PDT) From: "Jeff Ash (JIRA)" To: derby-dev@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. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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