Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 28535 invoked from network); 25 Apr 2006 01:11:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Apr 2006 01:11:19 -0000 Received: (qmail 62208 invoked by uid 500); 25 Apr 2006 01:11:19 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 62100 invoked by uid 500); 25 Apr 2006 01:11:18 -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 62076 invoked by uid 99); 25 Apr 2006 01:11:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Apr 2006 18:11:17 -0700 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; Mon, 24 Apr 2006 18:11:17 -0700 Received: from brutus (localhost.localdomain [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 100147142C2 for ; Tue, 25 Apr 2006 01:10:08 +0000 (GMT) Message-ID: <1457447.1145927408044.JavaMail.jira@brutus> Date: Tue, 25 Apr 2006 01:10:08 +0000 (GMT+00:00) From: "Satheesh Bandaram (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Reopened: (DERBY-628) setNull() using Types.VARCHAR for a CLOB parameter fails in embedded mode. In-Reply-To: <1018532398.1129333965957.JavaMail.jira@ajax.apache.org> 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 [ http://issues.apache.org/jira/browse/DERBY-628?page=all ] Satheesh Bandaram reopened DERBY-628: ------------------------------------- Reopening to mark fix in. > setNull() using Types.VARCHAR for a CLOB parameter fails in embedded mode. > -------------------------------------------------------------------------- > > Key: DERBY-628 > URL: http://issues.apache.org/jira/browse/DERBY-628 > Project: Derby > Type: Bug > Components: JDBC > Reporter: A B > Assignee: Satheesh Bandaram > Priority: Minor > Fix For: 10.2.0.0 > Attachments: patch, setNull.java > > If I attempt to call PreparedStatement.setNull() and specify Types.VARCHAR when the actual parameter type (as determined at bind time) is CLOB, Derby in embedded mode will throw an error, while Derby in client/server mode will succeed. > Ex. running the following code: > st.execute("create table t1 (c clob)"); > PreparedStatement pSt = conn.prepareStatement( > "insert into t1 values (?)"); > try { > pSt.setNull(1, Types.VARCHAR); > pSt.execute(); > System.out.println("Error did NOT reproduce."); > } catch (SQLException se) { > System.out.println("Error reproduced:"); > se.printStackTrace(); > } > Against Derby embedded, the result will be: > Error reproduced: > SQL Exception: An attempt was made to get a data value of type 'CLOB' from a data value of type 'VARCHAR'. > But against the Network Server, everything works fine. Derby embedded will work in other cases where compatible types are used (ex. using setNull() with Types.INTEGER for a BIGINT parameter), but fails for this particular situation. Thus I'm assuming this is _not_ intentional (i.e. that the above code should work). > Looks like the problem is in iapi.types.DataTypeDescriptor: > private static boolean isCharacterType(int jdbcType) { > switch (jdbcType) { > case Types.CHAR: > case Types.VARCHAR: > case Types.LONGVARCHAR: > return true; > default: > return false; > } > } > I think CLOB should be included in this list, too, shouldn't it? In iapi.types.TypeId, "isStringTypeId" is true for CLOBs as well as for the other character types, so it seems like the above method should have similar logic. -- 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