public static void main(String[] args) throws SQLException { DBConnection dbc = new DBConnection(); // generate the connection string and object Connection conn = dbc.getDBConnection(); // get the connection object //interact with the database Statement statement = conn.createStatement(); ResultSet resultSet = null; // get the result of the query to the database resultSet = statement.executeQuery(Suppliers.selectSuppliersTableString); System.out.println(Suppliers.columnHeadersString); // ResultPrinter.resultPrinter(resultSet); ResultSetMetaData rsmd = resultSet.getMetaData(); int columnCount = rsmd.getColumnCount(); System.out.println("Columns: " + columnCount); System.out.println(rsmd.getColumnName(0)); }