• Register
0 votes
271 views

Problem :

I am updating values using JDBC but getting bellow error
java.sql.sqlexception: column count doesn't match value count at row 1
6 5 3
6,930 points

1 Answer

0 votes

Solution :

Probably you are making a mistake with your quotes.

The proper Syntax as bellow:

INSERT INTO tablename(field1,field2) VALUES ('Text1,Text2'); 

So you need to write:

String Query_String = "INSERT INTO tablename(field1,field2) 
VALUES ('"+Text1+"','"+Text2+"')"

Further Readings:

9 7 4
38,600 points

Related questions

0 votes
2 answers 65 views
65 views
Problem : I am getting bellow error while trying to execute JDBC code java.sql.sqlexception: operation not allowed after resultset closed
asked Nov 1, 2019 peterlaw 6.9k points
0 votes
1 answer 10 views
10 views
Problem: I want to check if the very specific value already exists in the database. I am currently accessing database from the java standalone app using the JDBC my queries for inserting records into the db are working so my setup and the connection are perfectly fine. ... near 'd-f05708071f8f' at line 1 But if I attempt to execute above command in the MySQL command line then it works properly.
asked Aug 3 Raphael Pacheco 4.9k points
0 votes
1 answer 23 views
23 views
Problem: I am working on Hibernate and now I am facing what I believe is a simple problem with the Hibernate but still I can't solve it. I have written a simple class I would like to persist but still keep facing below error: SEVERE: Field 'id' doesn't have a ... that is not working for me. Initializing the id also did not help me either! I am looking for Hibernate expert to fix my above error.
asked Jul 30 Raphael Pacheco 4.9k points
0 votes
1 answer 7 views