× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm not 100% sure, but the NullPointerException may be coming from
the.trim() method.  rs.getString() should return NULL fine but then you are
attempting to trim a null String which would not work fine...

Joel R. Cochran
Director of Internet Services
VamaNet.com
(800)480-8810
mailto:webmaster@vamanet.com


> -----Original Message-----
> From: Patrick L Archibald [mailto:Patrick.Archibald@HOMETELCO.COM]
> Sent: Wednesday, July 31, 2002 8:49 AM
> To: java400-l@midrange.com
> Subject: RE: ResultSet null column
>
>
> Have you tried?
>
> String FIELDX = rs.getString("BFIELD2");
> if (FIELDX != null) FIELDX = FIELDX.trim();
>
> Thanx, PLA
>
> -----Original Message-----
> From: java400-l-admin@midrange.com
> [mailto:java400-l-admin@midrange.com]On Behalf Of
> Keith_McCully@wunderman.co.uk
> Sent: Wednesday, July 31, 2002 8:18 AM
> To: java400-l@midrange.com
> Subject: ResultSet null column
>
>
>
>
>
> I have built a prepared statement that links data from 2
> DB2/400 tables. Left
> join is used because there will not always be a key matched
> row in table B but I
> would always expect 1 row from table A.
>
> PreparedStatement stmt1 = connection.prepareStatement("SELECT
> AFIELD1, AFIELD2,
> BFIELD1, BFIELD2
>      FROM A LEFT JOIN B ON AFIELD1 = BFIELD1 WHERE AFIELD1 = ?")
>
> After I do a stmt1.executeQuery() into a ResultSet (rs) and
> then extract BFIELD2
> as
>      String FIELDX = rs.getString("BFIELD2").trim()
> If a matched row in file B exists when I load FIELDX, then
> everything works fine
> but ,if not ,then I get a NullPointerException.
>
> I tried testing rs.getString for null prior to FIELDX load
> but no success.  Any
> comments and suggestions on how to check for null would be
> very welcome!
>
> Thanks,
>
> Keith
>
>
> _______________________________________________
> This is the Java Programming on and around the iSeries /
> AS400 (JAVA400-L) mailing list
> To post a message email: JAVA400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
> or email: JAVA400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/java400-l.
>
>
>
> _______________________________________________
> This is the Java Programming on and around the iSeries /
> AS400 (JAVA400-L) mailing list
> To post a message email: JAVA400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
> or email: JAVA400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/java400-l.
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.