mysql - Invalid text content for insertion to database in Java? -
i trying store comments facebook post. there 25 comments , can them in json array , print console loop in java. when try store them mysql database, occurs 14th element of array. program ends without error or exception. stores 13 elements database , prints them console. if not connected database prints 25 elements console. control if clause, changing comment content this:
string content; (int j = 0; j < array.size(); j++){ if (j==13) { content = "changed content"; } else { content = ((jsonobject)array.get(j)).get("message").tostring(); }
and store elements db. of course 14th elements content stored "changed content."
i store them code:
string addcomments = "insert comments values("+commentid+",'"+commentfrom+"','" +content+"',"+likecount+",'"+createddate+"',"+postid+")"; stmt.executeupdate(addcomments);
i have no idea why problem occurs. i'm waiting help.
Comments
Post a Comment