Hi to all there !
i am trying to to execute the query to insert values into database but all the time facing this exception my code for query is this

String query=("INSERT INTO imageinfo (imgId,imgName,imgEntryDate,userName,imagePath) VALUES ( '"+ 0 +" ',' " + imgNam +"',' "+ date +"',' "+ userId +"',' " + location + "' ')");

and the bloody exception i m facing is

com.mysql.jdbc.exceptions.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 'D:\sk\ ')' at line 1


would any body help me out of this problem

thanks to helper in advance .

Recommended Answers

All 2 Replies

To avoid this problem use parameterised query - PreparedStatement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.