Announcement Announcement Module
Collapse
No announcement yet.
Calling AS400 Stored Procedure from Java using Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment

    Working...
    X