Did you look in the catalina.out file for any thrown Exceptions?  You are
try/catching and then System.out.println'ing them. You should have seen a
SQLException trace of some sort, read inline below...


> -----Original Message-----
> From: Mark Whitby [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 21, 2006 7:38 AM
> To: Tomcat Users List
> Subject: Servlet problem/Data Source Problem
> 
>    ResultSet rst = stmt.executeQuery("select id, chest from 
> testdata");

you're missing this:
     if (rst.next()) {

>             blob = rst.getInt("chest");
     }

you're also missing a WHERE clause in the query. You'll select everything
from testdata, by rs.next() will only get you to the first row.  To process
all rows, you make it a "while (rst.next()) { ", but then it would have to
be some sort of concatenation operation instead of just
blob=rst.getInt("chest"), because of course, if you did 'while', blob would
only contain the *last* row. So if you're interested in just the first row
or just the last row, there are more efficient ways of obtaining them.


>             address = "/testy.jsp?errorcode=" + blob;
>             stmt.close();
>             con.close();
>         } catch(NamingException e){
>             System.out.println(e.toString());
>         } catch(SQLException sql){
>             System.out.println(sql.toString());
>         }
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to