aspose file tools
The moose likes JDBC and the fly likes gettting value by column name vs index Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "gettting value by column name vs index" Watch "gettting value by column name vs index" New topic
Author

gettting value by column name vs index

rudra tripathy
Greenhorn

Joined: May 26, 2004
Posts: 24
Hi All,

Should we use rs.getString("columnname") or rs.getString(columnindex) and which one is fatser?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Faster is neither here nor there.

Name is safer. If you change the order of fields in your select statement your index based logic is broken.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
rudra tripathy
Greenhorn

Joined: May 26, 2004
Posts: 24
Thanks for the reply. Yeah.. Our architect is trying to push for column index and he claimed it is faster by column index. Tried googling, but couldn't get any definite answer for this.

Thannks
Rdura
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

Ask for proof.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: gettting value by column name vs index
 
Similar Threads
how to display more than one result from the db..
java.sql.Timestamp to Oracle date
query returning null
how to get values in an object?
String to decimal?