Skip to main content

Join Cache Row sets

No replies
indiika
Offline
Joined: 2009-06-07

Hi all,
I have used JoinRowsetImpl to join two cached row sets. And I have used ResultSetMetaData class to get the description of the results set. But my problem is ResultSetMetaData sometimes give null value for some columns. Please give me a suggestion
e.g
printing data

rsMetaData.getColumnLabel(i) + "-"+ rsMetaData.getCatalogName(i)+ "-"+ rsMetaData.getColumnClassName(i)+ "-"+ rsMetaData.getSchemaName(i) + rsMetaData.getColumnTypeName(i)

output
name-registration-java.lang.String- VARCHAR
null--java.lang.String- null -----------This is the problem
test_id--java.lang.String- varchar

Class.forName("com.ibm.db2.jcc.DB2Driver");
CachedRowSet employees = new CachedRowSetImpl();
employees.setUsername("db2admin");
employees.setPassword("db2admin");
employees.setUrl("jdbc:db2://localhost:50000/joindb");
employees.setCommand("SELECT * from EMPLOYEE");
employees.execute();

……………
JoinRowSet join = new JoinRowSetImpl();
join.addRowSet(employees,"DEPTID");
join.addRowSet(departments,"DEPTID");
……………………………

ResultSetMetaData rsMetaData = join.getMetaData();
int colCount = rsMetaData.getColumnCount();

String colName, colType;
for ( int i = 1 ; i <= colCount ; i++)
{
colName = rsMetaData.getColumnName(i);
colType = rsMetaData.getColumnTypeName(i);
System.out.println(colName);

}