|
I have created a sample table on a v5r2 iSeries and used the LABEL ON statement to set the column header (i.e. Column Label to Java's ResultSet object) to a human readable string. If I query the MetaData on the iSeries from STRSQL the labels for each column appear to be set correctly. However, if I pull the table contents into a ResultSet via the JT Open 4.6 AS400JDBCDriver and then get the MetaData for the result set I still end up with the COLUMN_NAME when I do resultSetMetaData.getColumnLabel(colIndex). The label added via LABEL ON does not seem to be honored by the JDBC Driver. Has anyone run into this before, and if so, is there a way to force the use of the column header so it will be returned via the ResultSetMetaData.getColumnLabel(colIndex) call? I've placed the table creation SQL statements and the code used to connect and retrieve the table data below: DROP TABLE sampleTable; CREATE TABLE QGPL/sampleTable ( COLUMN1 char( 20) not null with default , COLUMN2 char( 20) not null with default , COLUMN3 char( 20) not null with default ); LABEL ON COLUMN sampleTable ( COLUMN1 is 'Column One' COLUMN2 is 'Column Two' COLUMN3 is 'Column Three' ); I then connect to the iSeries and pull the data as follows: ---------------------------------------------- DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); Connection connection = DriverManager.getConnection ("jdbc:as400://" + system); DatabaseMetaData dmd = connection.getMetaData(); Statement select = connection.createStatement(); ResultSet rs = select.executeQuery ("SELECT * FROM QGPL" + dmd.getCatalogSeparator() + "sampleTable"); ResultSetMetaData rsmd = rs.getMetaData(); for(int j=1; j<=rsmd.getColumnCount(); j++) { System.out.println(rsmd.getColumnLabel(j)); } ---------------------------------------------- When printing the column labels I expect to get: Column One Column Two Column Three but instead get: COLUMN1 COLUMN2 COLUMN3 Is there any way to fix this? - Jason __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
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.