You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by anunay ashish <an...@tis.co.in> on 2003/10/11 14:27:07 UTC
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Difficulty in compiling a servlet.
Posted by Holger Klawitter <li...@klawitter.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> On compiling the addDataServlet.java, an error is coming - Unresolved
> symbol:Class DBUpadate is not resolved
DBUpdate is not in the classpath of the compiler when the servlet is being
compiled.
Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/iAQC1Xdt0HKSwgYRAnGTAJ9mVognPcpOFgLfwBU94CxNvK/9+wCeMw9N
xDuLDar8XqXTOOncKktqvq4=
=p4dV
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Difficulty in compiling a servlet.
Posted by anunay ashish <an...@tis.co.in>.
I don't have a syntax error any where.
----- Original Message -----
From: "Eric C" <ch...@wanadoo.fr>
To: "Tomcat Users List" <to...@jakarta.apache.org>
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" <an...@tis.co.in>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Difficulty in compiling a servlet.
Posted by Eric C <ch...@wanadoo.fr>.
Don't you have a syntax error somewhere ?
DBUpadate
----- Original Message -----
From: "anunay ashish" <an...@tis.co.in>
To: "Tomcat Users List" <to...@jakarta.apache.org>
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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org