// Source File Name: MRSPsrv.java 1.2
//
// Licensed Materials -- Property of IBM
//
// (c) Copyright International Business Machines Corporation, 1999.
// All Rights Reserved.
//
// US Government Users Restricted Rights -
// Use, duplication or disclosure restricted by
// GSA ADP Schedule Contract with IBM Corp.
// Sample Program MRSPsrv- This java code is the Stored procedure to
// return multiple resultsets back to the calling
// program which is called MRSPcli.java
// Steps to run the sample:
// (1) create and populate the SAMPLE database (db2sampl)
// (2) (n)make MRSPsrv
// (3) (n)make MRSPcli
// (4) run MRSPcli
// NOTES: (1) The jdk11_path database manager configuration parameter must
// be set
// (2) The CLASSPATH and shared library path environment variables
// must be set, as for any JDBC application.
// (3) Visit http://www.software.ibm.com/data/db2/java
// for current DB2 Java information
// For more information about this sample, refer to the README file.
// For more information on Programming in Java, refer to the
// "Programming in Java" section of the Application Development Guide.
// For more information on creating stored procedures, refer to the
// "Writing Stored Procedures" section of the Application Development Guide.
// For more information on building and running Java programs for DB2,
// refer to the "Building Java Applets and Applications" section of the
// Application Building Guide.
// For more information on the SQL language, refer to the SQL Reference.
// Class MRSPsrv contains one method:
// (1) MRSPsrv: stored procedure body
import java.lang.*;
import java.util.*;
import java.io.*;
import java.sql.*; // JDBC classes
import java.math.*; // BigDecimal
import COM.ibm.db2.jdbc.app.*; // DB2 UDB JDBC classes
import COM.ibm.db2.app.*; // StoredProc and associated classes
// //////////////////////////////////////////////////////////////////////
//
// Java stored procedure which takes 3 input String/Character parameters
// Each parameter is the SQL statement to be executed.
//
// //////////////////////////////////////////////////////////////////////
class MRSPsrv extends StoredProc
{
public void MRSPsrv (String q1, String q2, String q3)
throws Exception
{ try
{ // get caller's connection to the database; inherited from StoredProc
Connection con1 = getConnection ();
// create and execute statement based on 1st parameter passed in
Statement stmt1 = con1.createStatement();
stmt1.execute(q1);
// create and execute statement based on 2nd parameter passed in
Statement stmt2 = con1.createStatement();
stmt2.execute(q2);
// create and execute statement based on 3rd parameter passed in
Statement stmt3 = con1.createStatement();
stmt3.execute(q3);
}
catch (Exception e)
{ throw e;
}
}
}