× 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.



If I'm doing a left join using JDBC how can I tell if I got only rows from 
the left table and none from the right?  I'm getting a null pointer 
exception when I have only left table rows?  In the following code, 
WCCIVC# is part of the right table, and there are no rows returned for it. 
 Thanks, code follows:

                        getProps =
                                conn.prepareStatement(
                                        "SELECT A.CGSTREET#, A.CGSTNAME, 
B.WCCIVIC# FROM "
                                                + collectionName
                                                + 
dmd.getCatalogSeparator()
                                                + areaTable
                                                + " AS A LEFT JOIN "
                                                + collectionName
                                                + 
dmd.getCatalogSeparator()
                                                + custTable
                                                + " AS B ON A.CGSTREET# = 
B.WCSTREET# ORDER BY CGSTREET#, WCCIVIC#");
                        rs = getProps.executeQuery();
                        Vector vStreet = new Vector();
                        Vector vCivic = new Vector();
                        vStreet.clear();
                        vCivic.clear();
                        int tempStreet = 0;
                        String tempStName = new String();
                        while (rs.next()) {
                                if (tempStreet == 0) {
                                        tempStreet = rs.getInt("CGSTREET#"
);
                                        tempStName = rs.getString(
"CGSTNAME");
                                }
                                if (tempStreet != rs.getInt("CGSTREET#")) 
{
                                        vCivic.trimToSize();
                                        StreetInfo st =
                                                new StreetInfo(tempStreet, 
tempStName, vCivic);
                                        vStreet.addElement(st);
                                        tempStreet = rs.getInt("CGSTREET#"
);
                                        tempStName = rs.getString(
"CGSTNAME");
                                        vCivic = new Vector();
                                        vCivic.clear();
                                }
                                Integer c =
                                        new Integer(
 Integer.parseInt(rs.getString("WCCIVIC#").trim()));
                                if (!vCivic.contains(c)) {
                                        vCivic.addElement(c);
                                }
                        }

Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Tel: 709-576-8132
Email: rpower@xxxxxxxxxx
Website: http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. - 
Sir Winston Churchill

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.