com.mysql.jdbc.exceptions.MySQLSyntaxErrorException

刚才打Java代码出现了错误,百度了好多也没有解决掉,是更新数据库的错误,很急,求大神指教!!!

try {
			Jbuilder builder = new Jbuilder();
		    conn = builder.Jbuilder();
		    stmt2=conn.createStatement();
//		    String sql3="select * from news";
//		    rs3 = stmt2.executeQuery(sql3);
		    String sql = "update news SET mima = ?  where zhanghao = ?";   //SQL语句
		    ps = conn.prepareStatement(sql);
		    ps.setString(1, T2.getText());                      这两个文本框中获取的文本内容
		    ps.setString(2, T1.getText());
	        ps.executeUpdate(sql);         //将sql语句上传至数据库执行	        
	        int res=ps.executeUpdate();
			if(res>0){
				System.out.println("更新数据成功");
			}
			ps.close();

		}catch(SQLException e1) {
			e1.printStackTrace();
		}

错误提示:
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 ‘? where zhanghao = ?’ at line 1
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException_第1张图片
求大神!!!

你可能感兴趣的:(java)