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 gettting value by column name vs index Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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: 25
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: 25
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: 60794
    
  65

Ask for proof.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: gettting value by column name vs index
 
Similar Threads
query returning null
java.sql.Timestamp to Oracle date
String to decimal?
how to display more than one result from the db..
how to get values in an object?