Results 1 to 2 of 2

Thread: Calling AS400 Stored Procedure from Java using Spring

  1. #1
    Join Date
    Oct 2006
    Posts
    2

    Default Calling AS400 Stored Procedure from Java using Spring

    Hi,

    I need to call an AS400(DB400) stored procedure from my web application which is using Spring and Struts. Please help me with sample codes on how to do this.
    Also I am having all my queries in a properties file, and accessing the Datasource which is configured in the applicationcontext.xml

    Will I be able to use the same approach for the stored procedure call alos?

    Thanks in Advance,
    Anoop

  2. #2
    Join Date
    Jun 2007
    Posts
    8

    Default Use the JDBC StoredProcedure

    Extend the following class:
    org.springframework.jdbc.object.StoredProcedure

    http://www.springframework.org/docs/...toredProcedure

    The constructor should take your datasource.
    STORED_PROCEDURE_NAME should be the name of the stored procedure on the AS400.

    Code:
    super(ds, STORED_PROCEDURE_NAME);
    Within the constructor, declare your inputs and outputs of the stored procedure.

    Code:
    	        declareParameter(new SqlParameter(WHATEVER, Types.VARCHAR));
    	        declareParameter(new SqlOutParameter(NEXTPARAM, Types.VARCHAR));
    Create the stored procedure object, and call the execute operation that you have overwritten. Follow the steps in the URL provided above.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •