HP Driver for JDBC User's Manual

86 AppendixD
Simple Client Source Code
}
System.out.println("\n");
/* Print out the data, fetching until end of the result set */
String colValue;
while (rs.next())
{
/* For each column, print out the data as String */
for (i=1; i<=numCols; i++)
{
colValue = rs.getString(i);
/* If data was null, use the null string instead */
if (rs.wasNull())
colValue = "<NULL>";
System.out.print(colValue);
/* Print separator */
if (i < numCols)
System.out.print(", ");
}
System.out.println();
/* Fetch the next result set row */
}
System.out.println();
}
/**
* This captures console input until a CR is hit and
* then returns a Java String with the input.