Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getColumns() method on Databasemetadata returns empty for table synonyms

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic