I am using MySQL 4.1 with Java 1.4 and in a Swing application.
and using mysql-connector-java-3.0.16-ga JDBC Driver to connect to mysql.

I am executing a query using PreparedStatement and i am getting a ResultSet object with valid values from table. When I try to read data from the resultset by iterating it and using resultSet.getString(column_name), it is throwing "java.sql.SQLException: Column 'column_name' not found." Exception.

I have checked that particular column (named column_name) is there is table and also data is also there for that column in all rows. I am getting this exception only occasionally, it is not consistent and not able to reproduce intentionally. But in the stack trace, this is exception printed. And one more thing is, each time when it throws this exception, it says different column name each time.

Actually, If any column is missing in the table, "Unknown column 'column_name' in 'field list'" exception must be thrown at the time of executing the query itself, i.e. at prepareStatement.executeQuery(); step itself. It didn't throwed any exception there.

Any help / suggestions / thoughts in this regard is appreciated.