<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
       File reportFile = new File("D:\\YBC.jasper");
       Map parameters = new HashMap();
       parameters.put("name", "p");
       
      Connection conn=null;
      try{
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			conn = DriverManager.getConnection("jdbc:odbc:userDB","sa","1123");
		} catch(Exception e) {
			out.println(e.getMessage());
		}

       byte[] bytes = JasperRunManager.runReportToPdf(
                     reportFile.getPath(), 
                     parameters, 
                     conn
                     );
       response.setContentType("application/pdf");
       response.setContentLength(bytes.length);
       ServletOutputStream ouputStream = response.getOutputStream();
       ouputStream.write(bytes, 0, bytes.length);
       ouputStream.flush();
       ouputStream.close();
%>
