Well, I'm actually checking for NULL values before converting to string. And
I've checked the database for all NULL values, doesn't seem to have any.
This error now seems to occur when I execute my select query. The table has
three text fields, and when I select one of them (note that I'm not even
getting the textfield value, this is *just* when I select it) it gives me
the Null error message.
I'm also worried it might be the way I'm connecting to the database that's
causing this. Each time I go to a new JSP page I connect to the database,
execute a query, get the values and close the connection. So I'm not
actually keeping the connection open. Is this approach not working? Should I
keep one or more connection open, even though this is a not a heavy-traffic
site?
Thanks for helping.
>From: Stephen Summerfield <[EMAIL PROTECTED]>
>Reply-To: Stephen Summerfield <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Database text fields (cont.)
>Date: Tue, 7 Dec 1999 15:46:56 -0000
>
>I would guess that either resultset.getObject("Textfield") or
>resultset.getObject("Varcharfield") is null and causing your problem - ie
>the contents of these columns in your query are in fact NULL. You are then
>trying to do a toString() on a null pointer/reference which causes the
>error. You need to split the expressions down and do checks for null
>values.
>
>HTH,
>
>Steve
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification
> > and reference
> >
> > Sorry, I probably should have included an example of what I'm doing.
> >
> > ---
> > resultset = db.execute("Select Textfield, VarcharField From Table");
> >
> > while (resultset.next()) {
> > textfield = resultset.getObject("Textfield").toString();
> > varcharfield = resultset.getObject("Varcharfield").toString();
> > }
> >
> > resultset.close();
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html