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.
 
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.