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();
}