Stored Procedures and javabean applications
Storage Procedure sp_shop_base:
Create Procedure sp_shop_base (@ shop_id int, @ msg char (50) output)
As
SELECT shop_name, shop_phone, shop_email, shop_cash, shop_address
FROM shop_shop
WHERE shop_id = @ shop_id
SELECT @ msg = 'retrieval finished'
Return 1
Program:
<% @ Page contentType = "text/html; charset = gb2312" %>
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> JSP stored procedure-javabean-JDBC-ODBC-SQL Server </title>
</Head>
<Body>
<% @ Page language = "java" import = "java. SQL. *" %>
<Jsp: useBean id = "bka" scope = "page" class = "shop. bka"/>
<%
ResultSet RS = bka.exe cuteQuery ("{call sp_shop_base ('2 ','')}");
While (RS. next ()){
Out. println (RS. getString (1 ));
Out. println (RS. getString (2 ));
Out. println (RS. getString (3 ));
Out. println (RS. getString (4 ));
Out. println (RS. getString (5 ));
}
RS. close ();
%>
__________________________________________________