Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BC9710EA2 for ; Thu, 1 Aug 2013 05:20:26 +0000 (UTC) Received: (qmail 84680 invoked by uid 500); 1 Aug 2013 05:20:24 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 84579 invoked by uid 500); 1 Aug 2013 05:20:13 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Delivered-To: moderator for derby-user@db.apache.org Received: (qmail 50371 invoked by uid 99); 1 Aug 2013 00:02:32 -0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of steven.ebersole@gmail.com designates 209.85.214.180 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=r/hKV2ASi3gYdmFwGLtxbcSLR3KQWA3W+wAiDOGZ5D0=; b=pxY7+O2+BC34q+EZRV3TeJeNs0vqP5lm3aS9uHcQMLucTNl4aLJrttw6rthqmAdj+H VfVyHdPD4HO/QQ8SHeqK6nm1IhHnRlBLKHJSDm4Uy3LvKYefLWaXscNnY7magO4Dp0vz c6rZl9sgMc2LxzAKWpueTKyZS6kC4qaQgj8U0NEdsH1l4i+IJf5UoOHjg525yfBfHUnI CqbHUb3/JDQAb1wxDcBlT/Fm1cYpjwLHmCPzRWdHLhYdIZZ7+Ap+Zz1HH1mzBuLRTMUk EU185R2/vquYfwPs0y88TOqgK56sGdB7UGyPC+Og2iI+rwG8iPRuaw7rWHyDNktOs4cl rgnA== X-Received: by 10.60.63.33 with SMTP id d1mr7909181oes.103.1375315324435; Wed, 31 Jul 2013 17:02:04 -0700 (PDT) Sender: Steve Ebersole Message-ID: <51F9A579.5060204@hibernate.org> Date: Wed, 31 Jul 2013 19:02:01 -0500 From: Steve Ebersole User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: derby-user@db.apache.org Subject: Java stored procedure performing insert/update/delete Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I am trying to work out how to define a Java stored procedure using Derby that performs a insert/update/delete and results in the proper "update count" on the JDBC client. But I have so far been unsuccessful. Here is what I have... First, through JDBC I execute: create procedure deleteAllUsers() language java external name 'TheClass.deleteAllUsers' parameter style java TheClass.deleteAllUsers looks like: public static void deleteAllUsers() { Connection conn = DriverManager.getConnection( "jdbc:default:connection" ); PreparedStatement ps = conn.prepareStatement( "delete from t_user" ); int count = ps.executeUpdate(); System.out.println( "Count : " + count ); ps.close(); conn.close(); } And on the JDBC client side: Connection conn = ...; CallableStatement stmnt = conn.prepareCall( "{call deleteAllUsers()}" ); // yes I know this could be stmnt.executeUpdate()... stmnt.execute(); int count = stmnt.getUpdateCount(); So the deleteAllUsers() prints the correct count. But on the client, I always get zero (and not -1). Obviously I am doing something wrong. Any pointers? Thanks, Steve