myeclipse 10.7中用jsp无法连接mysql 5.5 单独用java文件却可以~
程序员文章站
2022-03-05 12:22:35
...
mysqljsp数据库myeclipse
我是要做一个简单的查询数据库操作,在win10 64位系统用tomcat 7 myeclipse 10.7用jsp无法连接数据库,提示NO SUITBLE Driver和空指针
但是我换成win 7 32位系统用tomcat 6 myeclipse 8,5 时就可以查询了,两边的代码和操作都一样~~求大神赐教~!
select.jsp中出错代码段: Student student=new Student();
//创com.ch6.dal.Studne的对象,命名为student
List list=student.getList(); //该方法返回一个LIST集合(显示这里出错)
for(StudentInfo info:list){
%>
Student.java如下:public class Student {
Conn conn=new Conn();
/*获取学生列表*/
public List getList() throws SQLException{
List list=new ArrayList();
String sql="select * from student order by number asc";
ResultSet rs=conn.executeQuery(sql);
**while(rs.next()){//这里显示空指针** StudentInfo info=new StudentInfo(); info.setId(rs.getInt("Id")); info.setNumber(rs.getString("Number")); info.setName(rs.getString("Name")); info.setAddress(rs.getString("Address")); info.setSex(rs.getString("Sex")); info.setPhone(rs.getString("Phone")); info.setEmail(rs.getString("Email")); list.add(info); } conn.close(); return list;}