Javaweb新手,配置jndi后连接数据后总出现异常
报错出现在 myConn = ds.getConnection();

修改my.ini后还是会出现这种问题

配置jndi的context.xml文件
web.xml文件
jdbc/studentinfo
javax.sql.DataSource
Container
StudentServlet
init.StudentServlet
StudentServlet
/StudentServlet
java文件
public class StudentServlet extends HttpServlet{
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=GB2312");
PrintWriter out = response.getWriter();
out.println("");
out.println("StudentInfo ");
if((request.getParameter("sno") == null || request.getParameter("sno").equals("input number"))){
out.println("");
}else if (!(request.getParameter("sno").equals("input number"))){
Vector vc = new Vector();
out.println("");
out.println("
");
out.println("");
out.println("学号 姓名 语文 数学 ");
try {
if((vc = accessDB(Integer.parseInt((String)request.getParameter("sno")))) != null){
out.println("");
out.println("" + vc.elementAt(0) + " ");
out.println("" + vc.elementAt(1) + " ");
out.println("" + vc.elementAt(2) + " ");
out.println("" + vc.elementAt(3) + " ");
out.println(" ");
}
}catch (Exception e){
out.println("");
out.println("没有记录: ");
out.println(" ");
out.println("数据库里没有你要查询得记录");
e.printStackTrace();
}
out.println("
");
}
out.println("");
out.println("