×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Check the CCSID of the job on the iSeries and make sure its not 65535.  At
V5R3 that's no longer valid.

Sincerely,
 
Sal Stangarone Jr.
michaels, ross & cole, ltd.
 
Phone: 630.916.0662
Fax: 630.916.0663
 
Web: www.mrc-Productivity.com 
 
Visit www.crazybikes.com to view a live demonstration of AS/400 Internet,
Intranet, and Extranet sites.

See Web applications displaying the kind of AS/400 data you might want to
port to your intranet, extranet, or the Internet at our demonstration site -
http://www.crazybikes.com 

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dave Murvin
Sent: Monday, March 07, 2005 6:26 PM
To: java400-l@xxxxxxxxxxxx
Subject: SQL results set NullPointerException

Hi,

I am trying to read a database file on the AS/400 in my test program running
on a PC.  I have been able to create the file and write records to the file.
Everything looks okay when I view the file on the AS/400.  When I try to
read the records, I get a null pointer exception at the point where I try to
extract the first field from the results set.  When I looked at the data for
the results set in debug, it didn't seem correct for some of the fields, but
the first field is a string and looks okay.  I have tried varchar and String
for the first field definition.  No differences.  Code snipit is:

  Statement stmt = null;
         ArrayList recordsRead = new ArrayList();
         ResultSet rs = null;
         String[] values = new String[0];
         try {
             DatabaseMetaData dmd = connection.getMetaData();
             stmt = connection.createStatement();
             String query = "select * from " +
                     collectionName + dmd.getCatalogSeparator() + tableName;
             rs = stmt.executeQuery(query);
             while (rs.next()) {
                 values[0] = rs.getString(1);                        // 
property type  <=== NullPointerException at this point
                 values[1] = new Integer(rs.getInt(2)).toString();   //
MLSid
                 values[2] = rs.getString(3);                        //
Address
                 values[3] = new Integer(rs.getInt(4)).toString();   // Sq 
footage
                 values[4] = new Integer(rs.getInt(5)).toString();   // 
Home owner d


File currently looks like this:

private String propertiesSQLCreate =
           "(Property_Type          for column PropType    char(30) not 
null, " +
           "Multiple_Listing_id     for column MLSID       integer not 
null, " +
           "Property_Address        for column Address     char(150), " +
           "Square_Footage          for column SQFootage   integer, " +
           "Home_Owners_Dues        for column HODues      integer, " +
           "Nbr_of_Bedrooms         for column Bedrooms    integer, " +
           "Nbr_of_Bathrooms        for column Bathrooms   integer, " +
           "Monthyl_Rent            for column MntlyRent   integer, " +
           "primary key( Multiple_Listing_id))";

Am I missing something?  Any ideas?
I am using the latest JTOpen.jar for my communications objects.  I am on
V5R3.

Thanks for the help.

Dave Murvin
DRM Enterprises, Inc.


-- 
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
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 ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.