If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > java.sql.SQLException: Column 'column_name' not found

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-04, 17:13
ckjkumar ckjkumar is offline
Registered User
 
Join Date: Nov 2004
Posts: 1
java.sql.SQLException: Column 'column_name' not found

Hi,

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.

Regards,
Jeyakumar
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On