wood burning stoves
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Column count doesn Watch "Column count doesn New topic

Column count doesn't match Exception

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 189
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

Joined: Aug 22, 2010
Posts: 3719

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
jQuery in Action, 3rd edition