You have to flush the sos object. This is the modified source.

          while(rs.next())
          {
               String str=rs.getString(1);
               res.setContentType("text/html");
              sos.println("the user_id is "+str);
               }
         }
          catch(Exception e)
          {   }

         sos.flush();      // added line
         sos.close();     // added line


      }
}

================================
Korea Telecom Chungbuk branch
Chaehwan Im
[EMAIL PROTECTED]
Phone:82-2-0431-210-5126~8
================================




-----���� �޽���-----
���� ���: thumma sunil <[EMAIL PROTECTED]>
�޴� ���: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
��¥: 1999�� 4�� 20�� ȭ���� ���� 7:54
����: PROBLEM WITH SERVLETS(DATABASE)


>hello everybody  iam sunil
>
>   i have a problem with servlets(database).i had compiled the source
>code successfully and placed the class file in the servlets dir of
>javawebserver1.1.3 which i had downloaded from java.sun.com
>the problem is whenever iam loading the file on the browser iam
>getting
> a message box that NO DOCUMENTS FOUND is appearing on the browser
>netscape navigator 4.0 .
>  this problem is for only for servlets that are trying to connect to
>the database. other servlets(other than the database) are working
>normally
>   could any  one can help me?
>   source code hope this is correct
>   import java.io.*;
>import java.sql.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>public class user extends HttpServlet
>{
>     Statement st;
>     public void service(HttpServletRequest req,HttpServletResponse
>res)
>     {
>
>          try
>          {
>          ServletOutputStream sos=res.getOutputStream();
>          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>// databse is msaccess
>          Connection
>con=DriverManager.getConnection("jdbc:odbc:sunil");
>          st=con.createStatement();
>          ResultSet rs=st.executeQuery("Select * from log");
>          while(rs.next())
>          {
>               String str=rs.getString(1);
>               res.setContentType("text/html");
>              sos.println("the user_id is "+str);
>               }
>         }
>          catch(Exception e)
>          {   }
>      }
>}
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>___________________________________________________________________________
>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