com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
Posted by: Sarfraj Khanjade
Date: December 22, 2012 12:01AM

do
{
String mid=res.getString(1);
String model=res.getString(2);
String name=res.getString(3);
int price=res.getInt(4);
String pcolor=res.getString(5);
String imei=res.getString(6);
java.sql.Date date=res.getDate(7);
String access=res.getString(8);

if(id.equals(mid) || id.equals(imei))
{
System.out.println("iam inside");

PreparedStatement prp=con2.prepareStatement("insert into msearch values(?,?,?,?,?,?,?,?)");
prp.setString(1,mid);
prp.setString(2,model);
prp.setString(3,name);
prp.setInt(4,price);
prp.setString(5,pcolor);
prp.setString(6,imei);
prp.setDate(7,date);
prp.setString(8,access);

prp.executeUpdate();

System.out.println("iam inside2");
rows++;

b=1;
jTextField1.setText("");
}


}while(res.next());



I am new to mysql
I am trying to execute above code ,I got com.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 '' at line 1

what should be the problem,please help,

Options: ReplyQuote


Subject
Written By
Posted
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
December 22, 2012 12:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.