WDbairen 2017-03-07 00:43 采纳率: 0%
浏览 977
已结题

myeclipse 加载数据库图片

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 'show order by show_id' at line 1
public class ShowDao{
public List findAll3 () throws Exception{
List showList=new ArrayList();
Connection conn =JDBC.getConnection();
String sql="select * from show order by show_id";

  PreparedStatement pstat=conn.prepareStatement(sql);
  ResultSet rs =pstat.executeQuery();
    while(rs.next()){
    Show show=new Show();
    show.setShow_id(rs.getInt("show_id"));
    show.setShow_image(rs.getString("show_image"));
    showList.add(show);
    }
    return showList;

}
}

  • 写回答

3条回答

  • qq_37792177 2017-03-07 02:05
    关注

    JDBC六个步骤,你只用了5个。最后别忘了释放资源

    评论

报告相同问题?