You haven't initialized the Statement (st). You need:
Statement st = conn.createStatement();
But before you can have this, you need conn (a Connection).
You'll have to modify the method to take a connection as a param or get one
in the method.
--jim
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
lramirez
Sent: Wednesday, July 05, 2000 5:15 PM
To: [EMAIL PROTECTED]
Subject: java.lang.NullPointerException:
Hi !!! I wrote the following Code and i got a problem !!!
its a method that returns a resultset, but id doesnt work on !!!
public ResultSet give_results (String val)
{
String chain;
try
{
chain="select id_reporte from reportes where id_is = " + val ;
System.out.println("Voy para alla con " + cadena );
rs = st.executeQuery(chain); // RIGHT HERE IT GIVES ME THE ERROR
!!!!!!!!!!!!!!!!(JAVA.LANG.NULLPOINTEREXCEPTION !!!! )
System.out.println("el resultset tiene: "+ rs.getRow() );
return rs;
}
catch (Exception e)
{
System.out.println("Error en Resultset: "+ e );
}
}
>From what i have read, its because i haven initialized the recordset or
statement class.
is it rght ???
thanks a lot !!!
Luis
___________________________________________________________________________
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