hi again, thanks for responses,
My code is below. It works correctly for two or three times when i start the server but then the server closes it self.

Cem
 

import java.sql.*;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class AskStatus5 extends HttpServlet {

  String s="";
  String n;
 
 
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");

        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println("<head>");

        out.println("</head>");
        out.println("<body bgcolor=\"white\">");
 
 

        out.println("<h3> Paper status query page </h3>");
        String id = request.getParameter("id");
        String name = request.getParameter("firstname");
 
        if (id != null && name != null) {
 
     String url = "jdbc:odbc:COFFEEBREAK2";
         Connection con;
         Statement stmt;
 
     String query = "SELECT id, name, paperstatus FROM status WHERE name='" + name+ "'";
         try {
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch(java.lang.ClassNotFoundException e) {
             System.err.print("ClassNotFoundException: ");
             System.err.println(e.getMessage());
         }
 
         try {
             con = DriverManager.getConnection(url, "myLogin", "myPassword");
             stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery(query);
 
       while (rs.next()) {
        s = rs.getString("id");
        String p = rs.getString("name");
        n = rs.getString("paperstatus");
       }

       stmt.close();
             con.close();
 
         } catch(SQLException ex) {
             System.err.println("SQLException: " + ex.getMessage());
         }
 
     if (id==s) {
            if(n=="accepted"){
       out.println(name + "Your paper has been accepted<br>");
      } else{
       out.println(name + "Your paper has not been accepted<br>");
            }
         } else{
       out.println("id or name error try again<br>");
     }
    } else {
            out.println("enter your name and id");
        }
    out.println("<P>");
        out.print("<form action=\"");
        out.print("AskStatus5\" ");
        out.println("method=POST>");
        out.println("id");
        out.println("<input type=text size=2 name=id>");
        out.println("<br>");
        out.println("name");
        out.println("<input type=text size=10 name=firstname>");
        out.println("<br>");
        out.println("<input type=submit>");
        out.println("</form>");
     out.println("</body>");
        out.println("</html>");
 
  }

    public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        doGet(request, response);
    }

}

sreecharana wrote:

Elobarate a bit more please..........!

Mr.Sreecharana.P.R
Designer, Preside Device Mediation Group
Infosys-Nortel OSDC
ESN 873+1381

> -----Original Message-----
> From: Cem Vardar [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 27, 2000 10:20 PM
> To:   [EMAIL PROTECTED]
> Subject:      Access 97, servlet, illegal operation
>
> Hi all,
> I am trying to connect ot a Access 97 database with a servlet and display
> some output on the web page. I am using the web server that comes with
> Servlet API and JDBC:ODBC bridge for connecting to the databse.. It
> sometimes works correctly but most of the time the web server gives and
> illegal operation and closes itself. (am using windows 98)
>
> Does anybody know what can be the reason?
>
> thanks in advance
>
> Cem Vardar
> __________________________________________________________________________
> _ To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body of the message "signoff SERVLET-INTEREST". Archives:
> http://archives.java.sun.com/archives/servlet-interest.html Resources:
> http://java.sun.com/products/servlet/external-resources.html LISTSERV
> Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to