无参数调用存储过程
来源:互联网 发布:dw软件 编辑:程序博客网 时间:2024/06/03 16:28
代码如下:
package com.test;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class dealbook extends HttpServlet {
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
Connection con=null;
ResultSet rst=null;
try{
con = DbConnection.getConnection();
CallableStatement cs = con.prepareCall("{call getAllBooks}");//调用无参数的存储过程
cs.execute();
rst = cs.getResultSet();
out.println("bookid/t");
out.println("bookname/t");
out.println("bookauthor/t");
out.println("bookprice/t");
out.println("bookdata/t");
out.println("bookleft/t");
out.println("<br/>");
while(rst.next()){
out.println(rst.getString("bookid"));
out.println(rst.getString("bookname"));
out.println(rst.getString("bookprice"));
out.println(rst.getString("bookdata"));
out.println(rst.getString("bookauthor"));
out.println(rst.getString("bookleft"));
out.println("<br/>");
out.flush();
}
rst.close();
cs.close();
con.close();
}catch(Exception e){
System.err.println(e.getStackTrace());
}
out.flush();
out.close();
}
}
- 无参数调用存储过程
- jdbc调用无参数输出的存储过程
- 存储过程+调用存储过程+无/带参的存储过程+in参数+out参数+int out参数+为参数设置默认值
- 调用带参数存储过程
- 调用参数化存储过程
- Oracle pl/sql编程 19---在java中调用无参数的oracle存储过程
- mysql 带有无参数的存储过程
- [FineReport]柱状图(无参数存储过程)
- SQLServer -- 自定义无参数存储过程
- Hibernate 调用无参存储过程
- .NET调用Oracle存储过程无响应
- SQLSERVER 存储过程调用存储过程,如何得到输出参数
- 存储过程调用存储过程且输出参数
- Oracle 存储过程 调用带有 out 参数的存储过程
- 关于C#调用存储过程,带输出参数,存储过程
- JDBC调用存储过程输出游标参数的存储过程
- 存储过程如何调用带参数的存储过程
- java调用存储过程返回参数
- 如何理解Perl语言中的Glob
- Servlet调用SQL Server2000存储过程实例
- SQL的系统存储过程xp_cmdshell
- Hibernate学习笔记!- -
- 创建XML文件
- 无参数调用存储过程
- vs.net中web services入门
- 一条短信引发的感想
- 数据库删除列
- 框架与系统架构
- hibernat学习
- Ruby and Rails 当时
- 第五周--星期四
- BS查询结果的链接都是http:////...