Hi,

Please advice what's wrong in the following  Servlet. Iam not getting a
value for Connection 'con':


Thanks
Vijay

import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import DB.database;

public class SimpleServlet extends HttpServlet
          {

ublic void doGet (HttpServletRequest request,
                                 HttpServletResponse response)
              throws ServletException, IOException
              {
                  PrintWriter         out;
                  String              title = "Simple Servlet Output";
        String query = "select NE_FIRST_NAME from ne_applicant where
ne_ssn='123456782'";
        database DATA= new database();
        Connection con=DATA.handle();
        ResultSet rset=DATA.fetchRows(con,query);
        String v="";
                  response.setContentType("text/html");
                  out = response.getWriter();
                  out.println("<HTML><HEAD><TITLE>");
                  out.println(title);
                  out.println("</TITLE></HEAD><BODY>");
                  out.println("<H1>" + title + "</H1>");
out.println("***"+DATA);
out.println("***"+con);

Iam not getting the "Con" value.
###########################################

database.java

package DB;
import java.io.*;
import java.sql.*;

public class database
{
public Connection handle()
{
Connection conn=null;

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + "TESTDB",
"glora", "glora");
}catch(Exception e){}
return conn;
}
public ResultSet fetchRows(Connection conn,String query)
{
        ResultSet rset=null;
try{
        Statement stmt = conn.createStatement ();
        rset = stmt.executeQuery (query);
    }catch(Exception e){}
return rset;
}
}
----------

___________________________________________________________________________
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