File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Question on resultset.getString(3) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Question on resultset.getString(3)" Watch "Question on resultset.getString(3)" New topic
Author

Question on resultset.getString(3)

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, have a nice day, everyone, i understand the parameter for getString() method is columnindex , can someone tell me how to i determine the parameter is belongs to ?

in mycase , i have try on resultset.getString(3); which give me the tablename , is it the "3" belongs to tablename ?

thank you !
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

Alvin,
Three refers to the third column. It is good to make the column list explicity so that you aren't suprised by what it refers to. For example,
select col1, col2, col3 from table


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Jeanne, I believe Alvin is referring to DatabaseMetaData.

Alvin, have a look at Javadocs for java.sql.DatabaseMetaData

If you are getting the ResultSet by calling the getColumns() method, column number 3 refers to the table name.

cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on resultset.getString(3)