Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getColumns() method on Databasemetadata returns empty for table synonyms

 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i get Information about table columns from TableSynonym.
getColumns name in DatabaseMetadata returns empty result set for tableSynonyms.

because of security restrictions and for easy database maintainence i should not use table names itself.

I am using following method to check number of columns in Table synonym.
passing tableSynonym for tableName pattern argument.

getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
Retrieves a description of table columns available in the specified catalog.

Do you guys suggest any work around to get Columns associated with real table from its synonym.
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What database backend and driver are you using? I've not seen this problem with views but it may be a driver issue.
 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using Oracle thin driver.
Infact i am able to retrieve columns for table synonym,i set the property setINcludeSynonyms(true) on
oracle.jdbc.driver.OracleConnection from ther eit works fine.

Now when i am trying to get Primary keys through table synonym.I am getting
empty result set for it.Please let me know if you have any solution for it.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic