File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Calling stored procedures from Java Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Calling stored procedures from Java Servlet

Donna Reschke

Joined: Jul 05, 2001
Posts: 23
If I need to call a stored procedure with 6 input parameters and 6 output parameters, how would I do this? Would it look like this?...
cstmt = con.prepareCall("{?, ?, ?, ?, ?, ? = CALL MKTDS22B (?, ?, ?, ?, ?, ?)}");
or this?...
cstmt = con.prepareCall("(CALL MKTDS22B (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?))" );
Please help! Thanks!
Gerry Giese
Ranch Hand

Joined: Aug 02, 2001
Posts: 247
Try the JDBC Documentation at
You'll probably get a much better response if you post in the JDBC forum instead of the Servlet forum, since this question has nothing to do with Servlets. Bartender, can you move it? Also, you should try searching the JDBC forum for similar questions that may have answers already.

CJP (Certifiable Java Programmer), AMSE (Anti-Microsoft Software Engineer)
Author of Posts in the Saloon
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
Calling a stored procedure from a servlet is a bad idea and usually indicates a poor design. You may want to add a layer of abstraction between your servlet and your data access calls, such as a data access object.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

This is a cross post in the JDBC forum.
I agree. Here's the link:
subject: Calling stored procedures from Java Servlet
jQuery in Action, 3rd edition