Yup, rek only has scope for the try block, you are trying to println outside
of rek's scope.  Put the out.println statement after your SELECT statement
before the catch block:
try {
        etc...
        ResultSet rek = stmt.executeQuery ("SELECT TOTAL FROM COFFEES WHERE
COF_NAME='ARABICA'");
        out.println(rek.getString());
}
catch etc...

-----Original Message-----
From: Erwan TROEL [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 25, 2000 7:31 AM
To: [EMAIL PROTECTED]
Subject: Undefined variable or class name


<%@ page info="database handler"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>
<%
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:test";

Connection con=DriverManager.getConnection(url, "administrator",
"password");
Statement stmt = con.createStatement();
ResultSet rek = stmt.executeQuery (
"SELECT TOTAL FROM COFFEES WHERE COF_NAME='ARABICA'");
}
catch (Exception e) {}

out.println(rek.getString());
%>
Does any body know the Pb? error 500:
org.apache.jasper.JasperException: Unable to compile class for
JSPC:\jakarta-tomcat\work\localhost_8080\_0002ftest_0002ejsptest_jsp_3.java:
98: Undefined variable or class name: rek out.println(rek.getString()); ^ 1
error

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to