This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes column names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "column names" Watch "column names" New topic
Author

column names

shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
hi all,
could someone tell me how to get the column names of a particular table using java.sql APIs.
i know we can use ResultSet and ResultSetMetaData.
but i want to get the result in a single database trip.
in ResultSetMetaData there is a mehotd getColumnName(int column).but i have to use it in a loop to retrieve all the column names. so i have to make many database trips which i dont want to.
i hope i have made my problem clear.
thanx in advance.
shanks.
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
hi all,
i got the answer before anybody could solve my problem.
i am making only a single databse trip i.e. during my sql query.
then all the information is stored in the resultset.
and when i use resultsetmetadata it gets the information from the resultset. i was under the wrong impression that its going to the database and getting the information.
shanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: column names
 
It's not a secret anymore!