0 Replies Latest reply on Nov 28, 2001 1:39 PM by adrian

    servelt problem

    adrian Newbie

      i have a servlet which select items from a database:
      here is the code..
      public class TreeServlet extends HttpServlet {
      public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
      res.setContentType("text/html");
      PrintWriter out = res.getWriter();
      .............
      ResultSet rs;
      ..............
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:merant","wwwedfro","php404");
      .............
      while ( rs.next() )
      out.print(rs.getString("fieldname"));
      //output exactly on yhe screen what is in that field
      //but if i try to assign that value to othe variable name var i mean:
      var = new String( rs.getString("fieldname") ) or var = rs.getString("fieldname")
      on screen apears error 500:internal server Error
      ....
      javax.servlet.ServletException: Servlet Could not display records.
      at TreeServlet.doGet(TreeServlet.java, Compiled Code)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
      at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java, Compiled Code)
      at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
      at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java, Compiled Code)
      at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java, Compiled Code)
      at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code)
      at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java, Compiled Code)
      at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
      at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code)
      at java.lang.Thread.run(Thread.java:479)

      Root cause:
      java.sql.SQLException: No data found
      at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java, Compiled Code)
      at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java, Compiled Code)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java, Compiled Code)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java, Compiled Code)
      at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java, Compiled Code)
      at TreeServlet.doGet(TreeServlet.java, Compiled Code)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
      at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java, Compiled Code)
      at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
      at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java, Compiled Code)
      at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java, Compiled Code)
      at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code)
      at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java, Compiled Code)
      at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
      at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code)
      at java.lang.Thread.run(Thread.java:479)

      I'm on win200 and tomcat 3.2.3 server...
      }