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;

}
}

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

你的sql语句出现错误,规则错误,你可以用简单点的"select * from show" 查一下。或者用这个"Select distinct id,name,age from show order by id desc"

String sql="select * from show order by show_id; "; sql语句可以改这样试试, order by show_id desc || asc 最好加着。 另外需要注意一点的是表名 show ,需要确认show 是否是mysql的关键字,最好避免。换个表名试试。