Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 37387 invoked from network); 13 Apr 2009 12:18:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Apr 2009 12:18:04 -0000 Received: (qmail 19585 invoked by uid 500); 13 Apr 2009 12:18:03 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 19480 invoked by uid 500); 13 Apr 2009 12:18:03 -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 Received: (qmail 19471 invoked by uid 99); 13 Apr 2009 12:18:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Apr 2009 12:18:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Apr 2009 12:17:55 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1LtL6U-0007GR-Js for derby-user@db.apache.org; Mon, 13 Apr 2009 05:17:34 -0700 Message-ID: <23021611.post@talk.nabble.com> Date: Mon, 13 Apr 2009 05:17:34 -0700 (PDT) From: sivagururaja To: derby-user@db.apache.org Subject: Derby Stored Procedure Help! MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: sivagururaja@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Hi All, I am creating the stored procedure in Derby DB. Here it is, CREATE PROCEDURE insertStud(IN RollNo Integer, in FirstName varchar(10)) PARAMETER STYLE JAVA MODIFIES SQL DATA LANGUAGE JAVA EXTERNAL NAME 'javadbsp.DBClass.insertStud' And the method is, public class DBClass { public static void insertStud(int rollno, String name) { try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); //or ClientDriver Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/Test", "uname", "passwd"); PreparedStatement ps1 = conn.prepareStatement("insert into SAM.STUD values(?,?)"); ps1.setInt(1, rollno); ps1.setString(2, name); ps1.executeUpdate(); conn.close(); } catch (Exception ex) { System.out.println("Error: "+ex.getMessage()); } } } My table structure is, create table "SAM".STUD ( ROLLNO INTEGER, FIRSTNAME VARCHAR(10) ) My class is, public class MyClass1 { ....... .......... public void insert() { try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); // or ClientDriver Connection Con1 = DriverManager.getConnection("jdbc:derby://localhost:1527/Test", "uname", "passwd"); CallableStatement cst = Con1.prepareCall("call insertStud(?,?)"); cst.setInt(1, Integer.valueOf(jTextField1.getText().trim())); cst.setString(2, jTextField2.getText().trim()); int i=cst.executeUpdate(); System.out.println("Rows Updated: "+i); } catch (Exception ex) { System.out.println("Error: "+ex.getMessage()); } } ...... } And i install the JAR files as per the document, http://wiki.apache.org/db-derby/DerbySQLroutines http://wiki.apache.org/db-derby/DerbySQLroutines I can able to run the application successful. But nothing can be inserted. Please let me know what could be the problem. -- View this message in context: http://www.nabble.com/Derby-Stored-Procedure-Help%21-tp23021611p23021611.html Sent from the Apache Derby Users mailing list archive at Nabble.com.