File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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: 180
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: 3611
    
  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