Here you can find the source of getIndexName(Connection conn, String table, String column)
public static String getIndexName(Connection conn, String table, String column) throws SQLException
//package com.java2s; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; public class Main { /**/*ww w . j ava 2 s . co m*/ * Returns the name of the index for the specified column in the specified table. */ public static String getIndexName(Connection conn, String table, String column) throws SQLException { ResultSet rs = conn.getMetaData().getIndexInfo("", "", table, false, true); while (rs.next()) { String tname = rs.getString("TABLE_NAME"); String cname = rs.getString("COLUMN_NAME"); String iname = rs.getString("INDEX_NAME"); if (tname.equals(table) && cname.equals(column)) { return iname; } } return null; } }