Two Laptop Bag*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Question on resultset.getString(3)" Watch "Question on resultset.getString(3)" New topic

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
internet detective

Joined: May 26, 2003
Posts: 30057

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.

Consider Paul's rocket mass heater.
subject: Question on resultset.getString(3)
Similar Threads
Connection with database...
why doesnt hibernate log input ?
Create procedure for inserting record into table : Table name dynamically as an Param
Create procedure for inserting record into table : Table name dynamically as an Param
how to create summary and detail table