This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Column count not matching the amount of columns in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Column count not matching the amount of columns in database" Watch "Column count not matching the amount of columns in database" New topic
Author

Column count not matching the amount of columns in database

A Joseph
Greenhorn

Joined: Dec 10, 2010
Posts: 7
Hi All,

I am having a problem with the above error being produced from my code



In the query variable I have



In the SQL code my schema is set up like this



My problem is that two of my columns are set automatically (userID, userLocked). So I thought all I need to set is the userName and password. But whenever I run this code I get the error Column count doesn't match value count at row 1. So how do I represent these columns without setting them in the code? Thanks in advance for any advice.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

"zero byte", please check your private messages for an administrative matter.


OCUP UML fundamental and ITIL foundation
youtube channel
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

you should use "insert into table (columnA, columnB) values (?, ?)"
 
jQuery in Action, 2nd edition
 
subject: Column count not matching the amount of columns in database