Do you know exactly which line in the try block fails?


-----Original Message-----
From: LeBaron Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 20, 2000 12:16 PM
To: [EMAIL PROTECTED]
Subject: [SERVLET-INTEREST]


Good morning all (esp. Nikhil)

I'm am struggling with the problem that Nikhil mentioned, I've got a Servlet
running

try {
            String query;
            query = "SELECT description FROM schema.table WHERE column = " +
somevalue;

            // Create a Statement and call that fine query
            stmt = localConn.createStatement();
            rs   = stmt.executeQuery( query );
            // Get the results
            if( rs.next() )
                name = rs.getString( "somevalue" );
        }
        catch (SQLException e) {
            Log.trace( "### SQLException thisproc ###\n" + e.getMessage());
        }
        catch( Exception e ) {
            Log.trace( "somevalue= " + somevalue );
            Log.trace( "### Some Exception in thisproc ###\n" +
e.getMessage());
            StackTrace stackTracer = new StackTrace( e );
            Log.trace( stackTracer.toString() );
        }

and I'm getting the 'Exception e' error (not the SQL exception), but only
when I run the Servlet through our authentication bean, if I add some debug
code to bypass the security bean and open the Servlet up straight away it
runs fine. any thoughts on why this might be? and what I can do to get it up
and running all the time?
I'm using Apache, Jserve and Jonas for my servers.

thanks,
LeBaron.

--- previous post ----
Hi,
I hope you know that statement.executeQuery("SQL") may return an empty
resultset, but never NULL. And the only way whether it is empty( i.e. your
select statement does not return any value) is to use the method
Resultset.next(), it will return true if there is any record to read. If you
are
getting exception I am sure this is not due to this( rs.next() some thing
else.)

Nikhil

___________________________________________________________________________
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

Reply via email to