wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to get a table name from a query? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get a table name from a query?" Watch "How to get a table name from a query?" New topic
Author

How to get a table name from a query?

sathish
Ranch Hand

Joined: Apr 25, 2000
Posts: 33
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

Joined: Nov 06, 2000
Posts: 1510
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

Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
sathish
Ranch Hand

Joined: Apr 25, 2000
Posts: 33
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

Joined: May 05, 2000
Posts: 13974
"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


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get a table name from a query?
 
Similar Threads
insert unique name into the table
need to get column names in resultant table of sql query
How to get table name from oracle query?
how to find all tablename and rowcount of each table from database?
count number of coulmns in table?