• 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

column names

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic