I don't have a syntax error any where.
----- Original Message -----
From: "Eric C" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Sunday, October 12, 2003 2:00 PM
Subject: Re: Difficulty in compiling a servlet.


> Don't you have a syntax error somewhere ?
>
> DBUpadate
>
>
>
> ----- Original Message -----
> From: "anunay ashish" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Saturday, October 11, 2003 2:27 PM
> Subject: Difficulty in compiling a servlet.
>
>
> > Hi,
> >
> > The code for my bean is:
> >
> > package com.scheduler;
> > import java.sql.*;
> > public class DBUpdate
> > {
> >     private Connection conn;
> >     private Statement stmt;
> >     private ResultSet rs;
> >  public DBUpdate()
> >     {
> >         conn = null;
> >         stmt = null;
> >         rs = null;
> >     }
> >  public void process(String query)
> >     {
> >         try
> >         {
> >
> Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
> >             Connection conn =
> >
DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.36:1521:myData",
> > "mangesh", "mangesh");
> >             stmt = conn.createStatement();
> >             rs = stmt.executeQuery(query);
> >    System.out.println("Query: " + query + " executed");
> >         }
> >         catch(Exception exception1)
> >         {
> >             System.out.println("Error occured in DBUpdate.process()
> > SQLException :" + exception1);
> >         }
> >     }
> >  public ResultSet getResultSet() throws SQLException
> >     {
> >      return rs;
> >     }
> >  public void destroy()
> >  {
> >         conn = null;
> >         stmt = null;
> >         rs = null;
> >  }
> > }
> >
> > And for my servlet is:
> >
> > package com.scheduler;
> > import java.io.*;
> > import java.sql.*;
> > import java.text.*;
> > import java.util.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > public class addDataServlet extends HttpServlet
> > {
> >  private String pageFormat;
> >  public void doPost(HttpServletRequest request, HttpServletResponse
> > response) throws ServletException, IOException
> >  {
> >   ResultSet testRS;
> >   DBUpdate dbupdate = new DBUpdate();
> >   pageFormat = request.getParameter("newPageFormat");
> >   PrintWriter out = response.getWriter();
> >   out.print(pageFormat);
> >   String query = "Select * from lookup_page_format";
> >   dbupdate.process(query);
> >   try
> >   {
> >    testRS = dbupdate.getResultSet();
> >       while(testRS.next())
> >    {
> >     out.print(testRS.getString(2));
> >     out.print("hi");
> >    }
> >   }
> >   catch (SQLException e)
> >   {
> >    out.println("SQLException :" + e);
> >   }
> >   try
> >   {
> >    //set the attribute and forward to pageFormat.jsp
> >    request.setAttribute("servletName", "addDataServlet");
> >
> >
>
getServletConfig().getServletContext().getRequestDispatcher("/Tracking_syste
> > m/pageFormat.jsp").forward(request, response);
> >   }
> >   catch (Exception ex)
> >   {
> >    ex.printStackTrace ();
> >   }
> >  }
> > }
> >
> > On compiling the addDataServlet.java, an error is coming - Unresolved
> > symbol:Class DBUpadate is not resolved
> > Where I am doing wrong?
> >
> > Thanks in advance.
> > Regards,
> > Anunay.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to