public static boolean isLinkedTable ( Connection connection , String tableReference ) throws SQLException { TableLocation location = TableLocation . parse ( tableReference ) ; ResultSet rs = getTablesView ( connection , location . getCatalog ( ) , location . getSchema ( ) , location . getTable ( ) ) ; boolean isLinked ; try { if ( rs . next ( ) ) { String tableType = rs . getString ( "TABLE_TYPE" ) ; isLinked = tableType . contains ( "TABLE LINK" ) ; } else { throw new SQLException ( "The table " + location + " does not exists" ) ; } } finally { rs . close ( ) ; } return isLinked ; }
Read INFORMATION_SCHEMA . TABLES in order to see if the provided table reference is a linked table .