1

I am currently working on SQL Server. I'd need to get all the relationships between tables in a schema. I was able to perform this operation by getMetaData on Oracle through:

meta.getImportedKeys(con.getCatalog(), dbName, null);

The same does not occur on SQL Server as the former throws the exception requiring the third parameter. My idea is to get the list of all the tables with

metaData.getTables(null, dbName, "%", null)

and iterating by substituting the third parameter on getImportedKeys. Is there an alternative to obtain the list of all relations from SQL Server?

dmachop
  • 824
  • 1
  • 21
  • 39
  • In SQL Server the database name is not the same thing as the schema. Also some JDBC drivers require you to use `"%"` for the `tablePattern` parameter. – Mark Rotteveel Jun 21 '14 at 07:54
  • @MarkRotteveel Yes, you're right. But even "%" does not yield results. – dmachop Jun 23 '14 at 13:48

0 Answers0