Check whether rs is null. The code should look something like this. And the
second field in the query should be of type string. I dont think jdbc
converts automatically.
ResultSet rs = stat.executeQuery(query);
try{
while(rs.next()){
sd = rs.getString(2);
}
}catch(Exception e)
System.out.println(e.toString());
}
If you have any questions let me know.
Madhavi
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Kelsey Fedde
Sent: Friday, December 10, 1999 5:45 PM
To: [EMAIL PROTECTED]
Subject: error messages
JDBCServlet.java:115: Variable rs may not have been initialized.
String sd = rs.getString(2);
�
JDBCServlet.java:115: Exception java.sql.SQLException must be caught, or it
must
be declared in the throws clause of this method.
String sd = rs.getString(2);
p.s. the 2 is meant to refer to line 2 of a db2 table I am accessing this
table from OS/390
I can't find and correct the error (been working on this for hours) I dont'
have a debugger and
write entirely in notepad....
suggestions?
thanks,
Kelsey
___________________________________________________________________________
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