How do you call stored procedures from JSP

Showing Answers 1 - 17 of 17 Answers

Natarajan

  • Jun 30th, 2005
 

Using Callable Statement.

  Was this answer useful?  Yes

phani

  • Jul 11th, 2005
 

By using callable statement we can call stored procedures and functions from the database.

  Was this answer useful?  Yes

Rahul Pundhir

  • Jul 14th, 2005
 

Thanks for giving me the Guidence

  Was this answer useful?  Yes

shalabh

  • Aug 8th, 2005
 

how to create bean and use themthrough jsp, plz give me with one example

  Was this answer useful?  Yes

sasi

  • Aug 15th, 2005
 

Hai 
u can bean like a simple java prg.and compile it to create the class file.then using the jsp:useBean attribute u can connect the Bean.

  Was this answer useful?  Yes

sekhar

  • Sep 12th, 2005
 

we can call the stored procedures from jsp by using scriptlet tab.write the jdbc code in between this tag.

  Was this answer useful?  Yes

vadivel

  • Oct 5th, 2005
 

sasi Wrote:Hai
u can bean like a simple java prg.and compile it to create the class file.then using the jsp:useBean attribute u can connect the Bean.

  Was this answer useful?  Yes

haijitu

  • Jan 26th, 2011
 

<%@ taglib uri="java2s.com.tags" prefix="cbck" %>
<html>
<head><title>Calling a Stored procedure</title></head>
<body>
<h2>This JSP calls a stored procedure with a JSP 2.0 function</h2>

${cbck:addEvent("Event Name","place","16-Jul-2005")}

</body>
</html>

  Was this answer useful?  Yes

delindia

  • Jan 2nd, 2012
 

We can call stored producedure using sql tags in jstl


Code
  1. For example, calling a stored procedure that returns a result set:

  2.  

  3. <sql:setDataSource var="myDataSource" dataSource="jdbc/myjndiref"/>

  4. <sql:query var="examples" dataSource="${myDataSource}">

  5.     exec ExampleProcLoadExample ?

  6.     <sql:param value="${exampleId}"/>

  7. </sql:query>

  8. <c:choose>

  9.     <c:when test="${fn:length(examples.rows) == 0}">

  10.         <%-- no rows returned ! --%>

  11.     </c:when>

  12.     <c:otherwise>

  13.         <c:set var="example" value="${examples.rows[0]}"/>

  14.         <%-- got your object, can access columns with . notation --%>

  15.     </c:otherwise>

  16. </c:choose>

  17.  

  18. For example, calling a stored procedure that performs an update (or insert/delete) returning number of rows updated:

  19.  

  20. <sql:setDataSource var="myDataSource" dataSource="jdbc/myjndiref"/>

  21. <sql:update var="updateCount" dataSource="${myDataSource}">

  22.     exec ExampleProcRemoveExample ?

  23.     <sql:param value="${exampleId}"/>

  24. </sql:update>

  25. <c:choose>

  26.     <c:when test="${updateCount le 0}">

  27.         <%-- no rows updated ! --%>

  28.     </c:when>

  29.     <c:otherwise>

  30.         <%-- some row(s) has been updated --%>

  31.         <c:out value="${updateCount} row(s) have been updated"/>

  32.     </c:otherwise>

  33. </c:choose>

  34.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions