Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Column Index out of range, 3 > 2 ( mysql error)

800443Sep 8 2008 — edited Sep 8 2008
Hello,
I am connecting to mysql server from a JSP page via eclipse, so for connecting to mysql I used Apache Derby.
When I want to query data of a table using SELECT statement I only able to get the first row of the table then I get the following error.
Column Index out of range, 3 > 2.
I don't know, I google the error i saw that lot's of people have this problem, and i could not find the answer wny?
can any one tell why I get this error?
this is the method for querying data:
public void executeStatement(String tbName,String query)throws Exception{
                // c is the Connection
		Statement statement = (Statement) c.createStatement();	 
		ResultSet rs = statement.executeQuery("select * from wordlist");
		int index = 1;
		while (rs.next()) {
			System.out.println(rs.getString(index));
			index++;
		}
		rs.close();
		statement.close();
		c.close();
	}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2008
Added on Sep 8 2008
9 comments
4,128 views