Here you can find the source of parse(Connection connection, String tableName, String type)
private static List<String> parse(Connection connection, String tableName, String type)
//package com.java2s; //License from project: Apache License import java.sql.*; import java.util.*; public class Main { private static List<String> parse(Connection connection, String tableName, String type) { List<String> result = new ArrayList<>(); try {//from w w w. j a v a 2s.c om ResultSet resultSet = null; if (type.equals("primary")) { resultSet = connection.getMetaData().getPrimaryKeys(null, null, tableName); } else { resultSet = connection.getMetaData().getColumns(null, null, tableName, null); } while (resultSet.next()) { result.add(resultSet.getString("COLUMN_NAME").toLowerCase());//INDEX:4 ,name } } catch (SQLException e) { e.printStackTrace(); } return result; } }