Examination system using JSP/SErvlet and MySQL

Hi
I am new to JSP /servlet.
I am designing online examination system using JSP/Servlet and MySQL ,where multiple choice questions would be selected randomly from the database. After completion of the examination user gets the results ,also the results would be stored in the database for the future reference.
Can anyone guide me for this? If possible give me the code for similar type of application.
Thanks

Sounds like you want someone else to do your homework for you, did you not read this:
"This forum works so much better when you try to program the code yourself, then let us know where it doesn't work. Otherwise you learn very little, and we work a whole lot."
and this
"If you want free code, have you tried searching Google for it? You may want to consider looking for survey software. It will give you the question/answer capabilities then all you have to do is find a way to grade the survey (if you will)...
If you are using Tomcat as your server, which you probably are, there is a jdbc tutorial included in the documentation, that is the fastest way to set up your database.
As for your random selection, have a look at Math.random(), this is one way to generate random numbers, you will need an algorithm to convert this value (between 0.0 and 1.0) into a form that can be used to select information from your database.

Similar Messages

  • Using a single connection for jsp, servlets and classes

    Hi! I'm building a web site that uses JSP, Servlets and some classes. I use database access in all my pages. I want to open a connection and use it for all the pages while the user is in my site, so I don't need to open a connection with every new jsp or servlet page. My software must be capable of connection with various databases, like SQLServer, Oracle, Informix, etc... so the solution must not be database (or OS or web server) dependant.
    Can you help me with this? Some ideas, links, tips? I'll REALLY appreciate your help.
    Regards,
    Raul Medina

    use an initialiation servlet with pooled connection which can be accessed as sesssion object.
    Abrar

  • File upload and download using jsp/servlets

    How to upload any file to the server using jsp/servlets. . Help me out

    You can also try the Jenkov HTTP Multipart File Upload. It's a servlet filter that is easy to add to your web-project. After adding it, you can access both request parameters and the uploaded files easily. It's more transparent than Apache Commons File Upload. There is sufficient documentation to get you started, and there is a forum if you have any questions.
    Jenkov HTTP Multipart File Upload is available under the Apache license, meaning its free to use.

  • Problem for getting the real path using one servlet and one jsp page

    I have one tomcat machine and several virtual domains. Eahc virtual domain has one realpath in the disc.
    I am using one servlet and one jsp page for using this servlet.
    my purpose is to load, using the servlet , the real path for the domains (eahc domain has its path).
    for this i make this:
    the servlet code is this:
    package utils.ticker;
    import java.io.*;
    import java.io.File;
    import java.io.IOException;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    public class Edicion extends HttpServlet{
    public Edicion() {
    public String cc(){
    ServletContext myContext= getServletContext();
    String abspath = myContext.getRealPath("/");
    //here i want to return the real path
    return abspath;
    public static void main(String args[]){
    and the jsp page is:
    <%@ page import="utils.ticker.*" %>
    <jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
    <html><head><body>
    <%
    tick.cc();
    %>
    </body></head></html>
    But this produces one error, NullPointerException and dont shows me the real path.
    Can anyone help me?
    thanks

    i have put this into one sevlet:
    package utils.ticker;
    import javax.servlet.ServletContext;
    public class Edicion{
    private ServletContext myContext;
    public Edicion(ServletContext myContext) {
    this.myContext = myContext;
    public String getCC(){
    return myContext.getRealPath("/");
    and in the jsp page this:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
    <%@ page import="utils.ticker.*" %>
    <jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
    <html><head><body>
    <%=tick.getCC()%>
    </body></head></html>
    but appear this error in the tomcat.
    Can you, please, help me. i am trying to solve this during one week and i am desesperate.
    Thanks.
    ERROR:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    javax.servlet.ServletException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
         at org.apache.jsp.pruebas_jsp._jspService(pruebas_jsp.java:72)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)
    Apache Tomcat/4.1.18

  • Unable to connect to mysql using JSP servlet

    Respected Sir/Madam
    I have made a jsp application and use tomcat 4 and mysql .Whenever there is a db connection the application tries to connect.but then it throws exception
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection timed out: connect
    This error started occuring all of a sudden and i am not getting its root cause...Can anybody help me out of this...?
    I am having intranet. And one thing that amazed me was when I send request for that JSP page from different machine then it connected to db without any error..Only when I request that JSP page from my machine it is giving me this error.
    Please help..
    Waiting for your reply.
    Thanks and Regards

    Microsoft Telnet> open Oracleserver
    Connecting To Oracleserver...Could not open a
    connection to host: Connect failedYou need to run the exact command i gave you from the command line. There may not be a telnet server running on OracleServer, you are trying to connect to port 23 with the command above.
    run 'telnet Oracleserver 3306'
    If this does not work, try the same thing with the IP address instead of 'Oracleserver', you may have a name resolution issue.
    I didnt understood this .I also tried running this
    command from other machines where my application is
    running fine. But there also the same error.
    I gave proper URL and user name and password for mysql
    String dsnString="jdbc:mysql://Oracleserver/test";FYI - this will use the default port, I usually explicitly provide it (OracleServer:3306). Why don't you try the URL in the format I gave you above, including the user id and password?
    -Scott

  • Is it posssible to lunch one application from the client system using JSP

    Is it possible to Lunch one application from the client system using JSP or Servlet .If it is possible then how can we do that ?
    Thanks in advance
    Sil

    If its a java application - yes. You can use jnlp and web start.
    ram.

  • Upload video by using jsp/servlet

    I'm using jsp/servlet to upload video file but I have a problem.
    This error occurs for preparing SQL statement when I cast OraclePreparedStatement.
    It is " Error : weblogic.jdbc.rmi.SerialPreparedStatement
    at jsp_servlet._upload._jspService(_upload.java:185)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
    Please help me asap.
    Thanks

    You need to use the Oracle jdbc driver. Apparently, the Weblogic JDBC driver is being selected:
    weblogic.jdbc.rmi.SerialPreparedStatement
    The Oracle JDBC classes can be found in <ORACLE_HOME>/jdbc/lib/See <ORACLE_HOME>/jdbc/readme.txt for how to specify the correct class path in the application.
    I would have thought that the oracle JDBC driver would have been selected (if in the classpath) or an exception would be raised if the Oracle JDBC driver was not found.... because the code should include:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    This should load the Oracle jdbc driver and classes, not the weblogic ones. IF the Oracle JDBC drivers are not found, an exception should be raised...

  • How do i Create charts using JSP/Servlet & Database

    I have to create charts which shows the graph of stock exchange.
    i have a database that keeps the data for creating charts.
    But i did not know how to create charts using jsp-servlet.
    Any Example might help me to go forward.
    Any help will be really appreciated.
    Please Advice me.

    JFreeChart - You can generate the charts then convert them to image formats (PNG and JPEG) all using the JFreeChart API
    http://www.jfree.org/jfreechart/

  • Deploying the JSPs, Servlets and Java class files

    Hello All,
    I'm very new to the Oracle 9i AS. We are using Version 1.0.2.2.
    How do we deploy the JSPs, Servlets, and Java class files (simple class files, not EJBs)?
    plese give us the procedure and stpes how to deply or the links for the same.
    Thanks,
    Santhosh.

    Hi
    I guess u r running apache-jserv as servlet engine for your jsp and servlets. If its so, jsp files can be run without any additonal configuration by putting the jsp file under document root or any subdirectory and for running servlets u have to add classpath entries for your servlet in jserv.properties file.
    To make sure that your servlet engine is working, try
    http://servername:port/servlet/IsItWorking, if u get success msg that means servlet engine is working fine.
    Hope this will help
    Regards
    Kumaran

  • Any good books on web application using JSP/servlet?

    Does anyone know good books on how-to build enterprise web application using JSP/servlet? Aside from the book "Head First JSP/Servlet". Development using Netbeans is more preferrable.

    801264 wrote:
    What about the free web server? JBoss or Glassfish or something else? I prefer web/application server that is fully compatible with JEE6 (unlike Tomcat that can't handle EJB). thanksI'm a JBoss user myself, so naturally I would advise that to you if I were ignorant. I'm not however, so in stead I'll tell you to investigate yourself and see which one you prefer. Nobody is going to tell you which one to use as there is no such thing as a 'better' or 'best' server. Just different servers each with different issues.
    And the community edition of JBoss has had many issues in the past (because Red Hat of course wants to advise you to go to the enterprise platform which ain't cheap), but JBoss 5.1 was a rock solid piece of software that I have had zero problems with (after reading the odd forum or two). JBoss 6 builds on top of JBoss 5.1 and provides the full JEE6 web profile; this means it does NOT provide a certified 'full' JEE6 stack yet. This means nothing however as all the services you may need in an enterprise application are already there.
    BTW: for simple servlet programming, don't neglect Apache Tomcat. Its a lightweight server that just works.

  • How to implement a dual booting PXI system using windows 7 and labview RT

    Good Day
    My name is Mariano Ocana from the University of Manitoba, and I want to implement a dual system using windows 7 and labview RT in a PXIe-1082 chassis with a PXIe-8102 embedded controlled (the chassis came with windows 7 installed). What are the steps to use both systems (windows and RT)  in the same chassis?, in the NI help comes an example implementing a dual system using windows xp and RT, it is the same procedure?.
    Thank you in advance for all your help.
    Regards
    M. Ocana

    Greetings, Mariano.
    The real issue you have to contend with is whether or not you have a LabVIEW RT license.  If the 8102 controller was purchased Windows-Only, you likely do not have a license to run LabVIEW RT on the controller - you can purchase one, I think it's about $500, and at that point you can request a LabVIEW RT Configuration CD (that's not what it's called, but the sales guy will know what I'm talking about).  The Config CD is a CD that will partition your controller correctly with both FAT32 and NTFS filesystems (in the appropriate way) to allow you to run Windows 7 and LabVIEW Real-Time on the controller correctly.  Once done, you can then switch within the BIOS between LabVIEW Real-Time and Windows in order to dual-boot.  
    Either way, you likely need to contact NI sales to either purchase an RT license (if one was not received at the time of purchase) or to request a Configuration CD (it might also be called a dual-boot install CD or similar).
    -Danny

  • Create login page using jsp, servlet  & Oracle

    hi,
    i need the sample application for creating login page using jsp, servlet & Oracle,can you please post one sample application.
    thanks
    sona

    See
    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/adfstrutsj2eesec.pdf
    Frank

  • HT1199 I judge my judgments, was written on Wordoffice 2007 on the system used to windos7 and Apple cant Read the job on the 2012 Word of Apple

    I judge my judgments, was written on Word office 2007 on the system used to windos7 and Apple cant Read my judgments on the 2012 Wordoffice of Apple

    Try these 3 possible solutions:
    1. Restart iPad
    Hold down the Sleep/Wake button until the red slider appears. Slide your finger across the slider to turn off iPad. To turn iPad back on, hold down the Sleep/Wake until the Apple logo appears.
    2. Close inactive Apps
    Double-click the Home button; hold Apps down (in the Task Bar) for a second or two until you see the minus sign. Tap and close all inactive Apps.
    3. Reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Ignore the red slider.

  • Web Based Telephone System (Using SIP server and Jsp servlet)

    Now i have more learning about Jsp and Servlet...All senior in Java.May i know how to build a system with Jsp n do the voice calling?

    i have do same thing with you..may i know what server r you using?

  • Using JSP/Servlet to write Word Document to BLOB

    Hi
    I need some help pls
    When I use a normal class with a main method, it loads the word document into a blob and I can read this 100%.Stunning.
    With a JSP/Servlet I cannot get the document out again. The "format" seems to be lost.
    Any ideas,help greatly appreciated:
    Here is the Main class that works:
    package mypackage1;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class TestLOB
    //static final Logger logger = Logger.getLogger("test");
    public TestLOB()
    public static void main(String args[])
    TestLOB testLOB = new TestLOB();
    testLOB.TestLOBInsert("c:\\my_data\\callcenterpilot.doc");
    public void TestLOBInsert(String fileName)
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    File binaryFile = new File(fileName);
    System.out.println("Document length = " + binaryFile.length());
    FileInputStream instream = new FileInputStream(binaryFile);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@oraclu5:1600:dwz110","so_cs","so_cs");
    catch (Exception ex)
    System.out.println("Error getting conn"+ex.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.out.println("Error closing connection in get last imei"+se.toString());
    Works fine:
    Here is the display servlet: Works when main class inserts file
    package mypackage1;
    import java.io.InputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class DisplayLOB extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    static final Logger logger = Logger.getLogger(DisplayLOB.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    //response.setContentType(CONTENT_TYPE);
    //PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    conn = getConnection("wizard");
    //out.println("<html>");
    //out.println("<head><title>DisplayLOB</title></head>");
    //out.println("<body>");
    //out.println("<p>The servlet has received a POST. This is the reply.</p>");
    InputStream is=null;
    oracle.sql.BLOB blob=null;
    response.setContentType("application/msword");
    //response.setContentType("audio/mpeg");
    OutputStream os = response.getOutputStream();
    String term = "1";
    String query = "SELECT docdetail FROM testlob WHERE docno = 1";
    pstmt = conn.prepareStatement(query);
    ResultSet rs = pstmt.executeQuery();
    while (rs.next())
    blob=((OracleResultSet)rs).getBLOB(1);
    is=blob.getBinaryStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[blob.getChunkSize()];
    while((length=is.read(b))!= -1)
    pos+=length;
    os.write(b);
    }//try
    catch (Exception se)
    se.printStackTrace();
    finally
    try
    pstmt.close();
    catch (Exception ex)
    System.out.println("Error closing pstmt "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    logger.fatal("Error getting connection: ",se);
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    logger.error("Error closing connection in get last imei",se);
    Here is JSP/Servlet
    <%@ page import="org.apache.log4j.*"%>
    <%@ page contentType="text/html; charset=ISO-8859-1" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    <title>Wizard SMS Interface</title>
    <link rel='stylesheet' type='text/css' href='main1.css'>
    <script language='JavaScript' src='copyright.js'></script>
    </head>
    <pre>
    <%
    //HTTP 1.1
    response.setHeader("Cache-Control","no-cache");
    //HTTP 1.0
    response.setHeader("Pragma","no-cache");
    //prevents caching at the proxy server
    response.setDateHeader ("Expires", 0);
    Logger logger = Logger.getLogger("co.za.mtn.wizard.administration.admin01.jsp");
    %>
    </pre>
    <body>
    <FORM ACTION="/WizardAdministration/uploadfile"
    METHOD="POST"
    ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="example">
    <INPUT TYPE="SUBMIT" NAME="button" VALUE="Upload">
    </FORM>
    </body>
    </html>
    <font> <b>Copyright &copy;
    <script>
    var LMDate = new Date( document.lastModified );
    year = LMDate.getYear();
    document.write(display(year));
    </script>
    Mobile Telephone Networks.
    <p align="left"><i><b><font face="Georgia, Times New Roman, Times, serif" size="1"></font></b></i></p>
    package co.za.mtn.wizard.admin;
    import java.io.InputStream;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class UploadFile extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    //static final Logger logger = Logger.getLogger(UploadFile.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String headerName = null;
    Enumeration en = request.getHeaderNames();
    try
    while ( en.hasMoreElements() )
    Object ob = en.nextElement();
    headerName = ob.toString();
    System.out.println("Value for headerNAme is >"+headerName+"<");
    String aaa = request.getHeader(headerName);
    System.out.println("Value for aa is >"+aaa+"<");
    catch (Exception ex)
    System.out.println("Error in extracting request headers"+ex.toString());
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    //File binaryFile = new File("h:\\callcenterpilot.doc");
    //System.out.println("Document length = " + binaryFile.length());
    //FileInputStream instream = new FileInputStream(binaryFile);
    response.setHeader("Content-Type","application/vnd.ms-word");
    String contentType = request.getContentType();
    System.out.println("Content type received in servlet is >"+contentType+"<");
    ServletInputStream instream = request.getInputStream();
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    System.err.println("Error getting connection: "+se.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.err.println("Error closing connection in get last imei"+se.toString());
    This is what the display servlet is showing when the JSP/Servlet insert the document
    -----------------------------7d31422224030e
    Content-Disposition: form-data; name="example"; filename="H:\(your name) Skills Matrix.doc"
    Content-Type: application/msword
    �� ࡱ � > ��     � � ���� � � ���������������������
    Tks
    Andre

    hello,
    there are multiple documents out there, describing the oracle reports server setup. try doc.oracle.com for documentation.
    also it is part of the online-documentation.
    you need to install 9iAS enterprise edition. the server is pre-configured and will listen to the url http://yourserver/dev60cgi/rwcgi60.exe
    passing only this url you will get a help-screen, describing the syntax.
    regards,
    the oracle reports team

Maybe you are looking for

  • Thumbnails

    Probably a question for Gunter. :-) Waaaaaaaay back with "MXK2", there was a Create Thumbnail behavior which creates image thumbnails - but it never put the file extension on! So the thumbnails were created with names like IMG21__th. These image do n

  • Can't move Object.

    I keep getting this Error Message when i try and move something i have pasted into CS5.1. "Can't Move the objects. The Command was Canceled" . It isn't locked. It's the only thing on the layer ( the layer isn't locked nor the image ).

  • No tabs are showing when only one window open. How do I open a new tab?

    Just upgraded to latest version. When only one window is open, no tabs show across the top. If I have two tabs open, both show across the top, but go to no tabs if I close one of them. And, the + sign is available for opening a third tab if at least

  • Flickering background render speedometer, will not render

    Hi, Using FCPX 10.1.1 (this also happend with 10.1) and I have background rendering checked it the preferences.  FCPX will not auto render when I leave the system idle for the ammount of time I have input into the prefs.  The little speedometer that

  • PSE 2 Übergänge in Präsentationen

    Hallo Community, ich bitte um Hilfe bei folgender Frage : Wenn ich mit PSE 2 eine Präsentation (pdf) erstelle, wähle ich als Übergang "Zufällig" aus. Auch wenn ich den Reader (7) unter Grundeinstellungen auf Vollbild -> Zufallsauswahl einstelle, über