This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Getting Column index Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting Column index" Watch "Getting Column index" New topic
Author

Getting Column index

Seema Hanji
Ranch Hand

Joined: Jan 29, 2001
Posts: 37
Hi All,
Is it possible to get column index from ResultSetMetaData ? I didn't see any methods for that...
Thanks,
seema
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
what do u mean the coloumn index?
u mean u supply the name and u get the index number??
it usually works the other way around.
u have all the coloumns and u want to know their names.
Seema Hanji
Ranch Hand

Joined: Jan 29, 2001
Posts: 37
In my code, I need to call metadata.getColumnDisplaySize(i);
This method takes column index, at this point I know column name not the index. So can I pass columnname and get column index from metadata ?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Not that I am aware of.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"SeemaH",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, 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 re-register and select a new name which meets the requirements.
Thanks.
Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting Column index