HP Driver for JDBC User's Manual

Appendix D 85
Simple Client Source Code
System.out.println(" Vendor code: " + ex.getErrorCode());
System.out.println(" Message : " + ex.getMessage());
ex = ex.getNextException();
System.out.println();
}
return;
}
/**
* Displays all columns and rows in the given result set
*/
private static void displayResultSet (ResultSet rs)
throws SQLException
{
int i;
/* Get the ResultSetMetaData. This will be used for
** the column headings.
*/
ResultSetMetaData rsmd = rs.getMetaData();
/* Get the number of columns in the result set */
int numCols = rsmd.getColumnCount();
/* For each column, print out the column names, separated by
** commas
*/
for (i=1; i <= numCols; i++)
{
System.out.print(rsmd.getColumnName(i));
/* Print separator */
if (i < numCols)
System.out.print(", ");