This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem geting column value. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem geting column value." Watch "Problem geting column value." New topic
Author

Problem geting column value.

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
Hi,
Please look at the following code



This code is throwing exception ... "array index out of range". I have checked it and it comes only when i use rs (resultset object) to retrieve the value.


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Muhammad Ali,

I think int i should start with the value 1 (not with 0):

the JavaDoc for ResultSetMetaData says:
column - the first column is 1, the second is 2, ...

Herman
Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
yeah, one possible reason was that. The other reason was, i must have done "rs.next()" in order to get a value from the record.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem geting column value.
 
Similar Threads
ResultSet--Can not able to get the value of the column
Using Combo Boxes in JSP & Servlet
Column name for getGeneratedKeys()?
sql server callable statement result set issue..
How to write contents of oracle table into csv file?