Here is the error,
errorcom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Desc,Author) values('jdsaklv','jdskalf','jsdalkf')' at line 1
and here is my code.I am not getting what error is..please help.,
public boolean adddatablog( String name1,String Desc1,String Auth1)
{
boolean result = false;
PreparedStatement psmt=cn1.prepareCall("insert into blog(Name,Desc,Author) values(?,?,?)");
psmt.setString(1,name1);
psmt.setString(2,Desc1);
psmt.setString(3,Auth1);
result=psmt.execute();
return result;
}
解决方案Desc is a keyword[^] in MySql. Thus your query fails on the second line.
To fix the problem, escape the column name.
Try "insert into blog(Name,"Desc",Author) values(?,?,?)");