This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get a table name from a query?

 
sathish
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone j=know how to get a table name from a query?
like Select * from Employ... i want to get the table name. Kindly help
Thanks
sathish
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a reference to the database metadata, and then just use that to get information about the database. Check the API for metadata.
Bosun
 
sathish
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bosun
i checked the API, but i just want to know the table name before the execution of query, but still, when i run through the query, i can't get the table name through the resultsetmetadata.
Does the method getTableName() get me the table name?? but i got null.
Thanks
sathish
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"santish"
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention whci hyou agreed to when you registered, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please create a new log in with a new name which meets the requirements.
Thanks.

------------------
Moderator of the JDBC Forum
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic