/* * Copyright 2003 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * Use of this software is authorized pursuant to the terms of the license found at * http://developer.java.sun.com/berkeley_license.html. */ import java.sql.*; public class PrintColumnTypes { public static void printColTypes(ResultSetMetaData rsmd) throws SQLException { int columns = rsmd.getColumnCount(); for (int i = 1; i <= columns; i++) { int jdbcType = rsmd.getColumnType(i); String name = rsmd.getColumnTypeName(i); System.out.print("Column " + i + " is JDBC type " + jdbcType); System.out.println(", which the DBMS calls " + name); } } }