Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 47108 invoked from network); 24 Apr 2008 18:18:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2008 18:18:58 -0000 Received: (qmail 81021 invoked by uid 500); 24 Apr 2008 18:18:59 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80987 invoked by uid 500); 24 Apr 2008 18:18:59 -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 80976 invoked by uid 99); 24 Apr 2008 18:18:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 11:18:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msatoor@gmail.com designates 209.85.198.246 as permitted sender) Received: from [209.85.198.246] (HELO rv-out-0506.google.com) (209.85.198.246) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 18:18:15 +0000 Received: by rv-out-0506.google.com with SMTP id b17so1740039rvf.55 for ; Thu, 24 Apr 2008 11:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=l5yZVDVqSqS+vs9083umBnaMPa58ITwBa9DuP9FC+d4=; b=tMwZ1x1H1piVDKhDkyJHG8b7cQtYNKaNi6Ij8lHwqpP5G7C20dMfgdDTkYOb6hNc2mXr2B7b4TR9626+dArBDrs8WDLN5/gHLdVjMJvbao5bXL1dyaXq1/6v58NGf4x1oxdaPgIVdQYSQF70bcEqZiZo/kHxwEKEUB65kcgj+Tk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Ekkl9NEt/5eYKmIgiid4fkvuKRePffdlEt1vlYerAAcFo6QERrIg9WgdGhjIb7BMLo3j7ErciG+ysAJYWYlPwkXC1Rbq5hZ+1oo6CN8qJvTqfKLr1HhkQynopidscAYxbjKf1E/ylMMOtDBLJk/zLRDpkScZs/ya+A0EzhFFYdI= Received: by 10.141.22.1 with SMTP id z1mr1298939rvi.277.1209061109239; Thu, 24 Apr 2008 11:18:29 -0700 (PDT) Received: by 10.141.49.17 with HTTP; Thu, 24 Apr 2008 11:18:29 -0700 (PDT) Message-ID: Date: Thu, 24 Apr 2008 11:18:29 -0700 From: "Mamta Satoor" To: "Derby Development" Subject: Table Function : Fixing the Java class while the database session is still on does not get reflected....... MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Hello, What I am experiencing might be an expected behavior and if not, the issue might be how user functions are implemented in Derby (ie both scalar and table functions) and not specific to table functions. I have defined a table function as follows CREATE FUNCTION testFunctionTable () RETURNS TABLE ( tableId INT ) LANGUAGE JAVA PARAMETER STYLE DERBY_JDBC_RESULT_SET READS SQL DATA EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.lang.DERBY_716_BuddyTesting.read'; As can be seen from the definition above, the return table is expected to have an int column. The implementation of DERBY_716_BuddyTesting.read looks as follows public static ResultSet read() throws SQLException { Connection conn = null; Statement stm = null; conn = DriverManager.getConnection("jdbc:default:connection"); stm = conn.createStatement(); //The table function is defined to return a ResultSet with int column but we are //returning a string which can't be converted to int datatype ResultSet rs = stm.executeQuery("values current_user"); return rs; } The method above returns a ResultSet with a string value which can't be converted to int and hence when I try to use the table function in a select statement, I get following behavior select * from table(testFunctionTable()) a1; ERROR 22018: Invalid character string format for type int. java.sql.SQLDataException: Invalid character string format for type int. I went ahead and fixed the method to return a int value as follows and then recompiled it public static ResultSet read() throws SQLException { Connection conn = null; Statement stm = null; conn = DriverManager.getConnection("jdbc:default:connection"); stm = conn.createStatement(); ResultSet rs = stm.executeQuery("values 1"); return rs; } I thought I would see the fix the next time in the same database session if I execute the same select again. But that didn't work. Next, I dropped the function and recreated it and then issued the select statement but it still gave the same exception. In order to pick up the changes made to DERBY_716_BuddyTesting.read, I had to reboot the database. Is this expected behavior? thanks, Mamta