码迷,mamicode.com
首页 > 数据库 > 详细

IDEA+MySQL实现登录注册的注册验证时出现 Cannot resolve query parameter '2'

时间:2019-04-21 21:46:23      阅读:728      评论:0      收藏:0      [点我收藏+]

标签:mail   target   pre   targe   server   rod   ann   运行   trace   

问题描述:

在IDEA+MySQL+Tomcat 实现登录注册JSP的注册信息INSERT验证时出现 Cannot resolve query parameter ‘2‘

技术图片

贴上创建链接的代码:

 if(conn != null){
            String sql = "SELECT *FROM login_info WHERE DBuser=?";
            pstm = conn.prepareStatement(sql);
            pstm.setString(1,user);
            rs = pstm.executeQuery();
            if(!rs.next()){
                sql = "INSERT INTO login_info(DBuser,DBpass,Age,Email,Gender,Hobby,Education,Introduce) VALUE(?,?,?,?,?,?,?,?)";
                pstm = conn.prepareStatement(sql);
                pstm.setString(1,user);
                pstm.setString(2,pass);
                pstm.setString(3,age);
                pstm.setString(4,email);
                pstm.setString(5,gender);
                pstm.setString(6,hobby);
                pstm.setString(7,education);
                pstm.setString(8,introduce);
                pstm.executeUpdate();
            }else{
                out.println("该用户名已存在");
            }

            int row = pstm.executeUpdate();
            if(row>0){
                out.println("成功添加"+row+"条数据!");

            }
        }
        else{
            out.print("连接失败!");
        }

    }catch (Exception e) {
        out.print("数据库连接异常!");
        out.println(e);
        e.printStackTrace();
    }finally
    {
        try
        {
            if (rs != null)
                rs.close();
            if (pstm != null)
                pstm.close();
            if (conn != null)
                conn.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

运行起来显示

数据库连接异常

查看异常显示

 The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

技术图片

 

IDEA+MySQL实现登录注册的注册验证时出现 Cannot resolve query parameter '2'

标签:mail   target   pre   targe   server   rod   ann   运行   trace   

原文地址:https://www.cnblogs.com/xuango/p/10747103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!