aspose file tools*
The moose likes JDBC and the fly likes Column count doesn't match Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Column count doesn Watch "Column count doesn New topic
Author

Column count doesn't match Exception

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 176
Hello Everyone
I am trying to insert data from a form into mysql in java but i am getting SQL Exception stating = "Column count doesn't match value count at row 1".
Code i am using is as follows :
I think the mistake is in the values bracket. Please correct me where i am wrong.
Thanks in Advance!!
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

I'd say you're missing commas between the values. But you should use PreparedStatement (⇐ read why) instead anyway:

(I'd use executeUpdate instead of execute for an INSERT statement, but the PreparedStatement part is much more important.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Column count doesn't match Exception