Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 32305 invoked from network); 24 Sep 2008 19:34:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Sep 2008 19:34:43 -0000 Received: (qmail 98309 invoked by uid 500); 24 Sep 2008 19:34:40 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 98275 invoked by uid 500); 24 Sep 2008 19:34:40 -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 98264 invoked by uid 99); 24 Sep 2008 19:34:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Sep 2008 12:34:40 -0700 X-ASF-Spam-Status: No, hits=-1999.8 required=10.0 tests=ALL_TRUSTED,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Sep 2008 19:33:40 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 47E3E234C1F6 for ; Wed, 24 Sep 2008 12:33:44 -0700 (PDT) Message-ID: <434279838.1222284824293.JavaMail.jira@brutus> Date: Wed, 24 Sep 2008 12:33:44 -0700 (PDT) From: "Myrna van Lunteren (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3390) SQLException thrown from user function kills network connection In-Reply-To: <6970949.1202222528723.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634263#action_12634263 ] Myrna van Lunteren commented on DERBY-3390: ------------------------------------------- for reference, this is what embedded returns: ij> values badFunction(); 1 ----------- ERROR 38000: The exception 'java.sql.SQLException: I refuse to return an int!' was thrown while evaluating an expression. ERROR 5000: I refuse to return an int! > SQLException thrown from user function kills network connection > --------------------------------------------------------------- > > Key: DERBY-3390 > URL: https://issues.apache.org/jira/browse/DERBY-3390 > Project: Derby > Issue Type: Bug > Components: Network Server > Affects Versions: 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1 > Reporter: Rick Hillegas > Assignee: Myrna van Lunteren > Attachments: DERBY-3390_a.diff, DERBY-3390_b.diff > > > Thanks to Frank Griffin for pointing out this issue in a derby-dev email thread: http://www.nabble.com/SQLException-thrown-from-Table-Function-ResultSet-to15241332.html#a15241332 > If a user-coded function throws a SQLException, Derby will try to cast the exception to a Derby exception class before shipping the exception to the network client. This raises a ClassCastException and kills the connection. I have observed this in 10.4, 10.3, 10.2, and 10.1. You can reproduce this problem with the following function class and sql script. > The function class: > import java.sql.*; > public class BadFunction > { > /** > *

> * This function just throws a SQLException. > *

> */ > public static int badFunction() > throws SQLException > { > throw new SQLException( "I refuse to return an int!" ); > } > > } > Here is the SQL script: > connect 'jdbc:derby://localhost:8246/derby10.4'; > drop function badFunction; > create function badFunction() > returns int > language java > parameter style java > no sql > external name 'BadFunction.badFunction' > ; > values ( badFunction() ); > values ( badFunction() ); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.