I'm trying to write a little program that reads data from an Access
database and loads an Iseries Database.  
 
Here is the jist of the code. 
                        stmtdb = condb.createStatement();
                        while (rs.next()) {//B2 
                                int instrument_type = rs.getInt(1);
                                int siteId = rs.getInt(2);
                                int siteId2 = rs.getInt(3);
                                String crckey     = rs.getString(4);
                                String logdate    = rs.getString(5);
                                int linkField     = rs.getInt(6);
                                int logTrigger    = rs.getInt(7);
                                int alarms        = rs.getInt(8);
                                   String data1         =
rs.getString(9);
                                String data2         = rs.getString(10);
                                String data3       = rs.getString(11);
                                String data4       = rs.getString(12);
                                String data5         = rs.getString(13);
                                String data6         = rs.getString(14);
                                String data7         = rs.getString(15);
                                String data8         = rs.getString(16);
                                String data9       = rs.getString(17);
                                String data10      = rs.getString(18);
                                String editFlag   = rs.getString(19);
                                String alarmsFlag = rs.getString(20);

                                String query2 = "INSERT into MercAud00 "
+ 
                                "VALUES (" + instrument_type
                                                + "," + siteId 
                                                + "," + siteId2
                                                + ", " + "'" + crckey +
"'" 
                                                + ", " + "'" + logdate +
"'"
                                                + ", " + linkField
                                                + ", " + logTrigger
                                                + ", " + alarms
                                                + ", " + data1
                                                + ", " + data2  
                                            + ", " + data3
                                                + ", " + data4
                                                + ", " + data5
                                                + ", " + data6
                                                + ", " + data7
                                                + ", " + data8
                                                + ", " + data9
                                                + ", " + data10
                                                + ", " + "'" + editFlag
+ "'"
                                                + ", " + "'" +
alarmsFlag + "'"
                                                + ")";
                                System.out.println(instrument_type + ",
" + siteId + ", " + siteId2 + ", " + crckey + ", " + logdate + 
                                        ", " + linkField + ", " +
logTrigger + ", " + alarms
                                        + ", " + data1 + ", " + data2 +
", " + data3 + ", " + data4 +
                                        ", " + data5 + ", " + data6 + ",
" + data7 + ", " + data8 + ", "
                                        + data9 + ", " + data10 + ", " +
editFlag + ", " + alarmsFlag);
                                stmtdb.execute(query2);


Here is the last line printed in the System.out
3, 12, 4, 000D, 2006-08-26 10:22:49, 5, 3, 0, 0, 0, 456.30, 84.33,
638163, 193449, 0, null, .00, 8.22, 0, 

This record is where my program is blowing up.  I suppose it is
happening on the null value.  

How do I handle this?.  I tried putting a coalesce(data8) in the insert
statement, but it didn't like that very much.  


Michael Smith
iSeries.mySeries.


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