如何在aws中运行java lambda函数

时间:2016-08-25 05:14:24

标签: java sql oracle jdbc

尝试{             PreparedStatement pst = con.prepareStatement(“INSERT INTO employee_details(E_NAME,E_PASSWORD,E_USERNAME,E_CONTACT,”)                     +“E_ROLE”VALUES(?,?,?,?,?);“);             状态= 1;

        pst.setString(1,employee.getEname());//Step 7: calling getter() from getter/setter class
    //Step 10: setting getter values to corresponding query
        pst.setString(2,employee.getPass());//Step 7: calling getter() from getter/setter class
            //Step 10: setting getter values to corresponding
        pst.setString(3,employee.getUname());//Step 7: calling getter() from getter/setter class
            //Step 10: setting getter values to corresponding 
        pst.setString(4,employee.getEcontact());//Step 7: calling getter() from getter/setter class
            //Step 10: setting getter values to corresponding 
        pst.setInt(5,employee.getUrole());//Step 7: calling getter() from getter/setter class
            //Step 10: setting getter values to corresponding 
        pst.executeQuery();
        System.out.println("name:"+employee.getEname()+"  pass:"+employee.getPass()+"   uname:"+employee.getUname()+"  con:"+employee.getEcontact()+"  role:"+employee.getUrole());

    }
    catch(SQLException e){
        e.printStackTrace();
    }

1 个答案:

答案 0 :(得分:0)

准备语句末尾有一个不需要的分号,因此请将其删除。

试试这个

 PreparedStatement pst=con.prepareStatement("INSERT INTO employee_details (E_NAME,E_PASSWORD,E_USERNAME,E_CONTACT,"
                + "E_ROLE) VALUES (?,?,?,?,?)");

而不是

 PreparedStatement pst=con.prepareStatement("INSERT INTO employee_details (E_NAME,E_PASSWORD,E_USERNAME,E_CONTACT,"
                + "E_ROLE) VALUES (?,?,?,?,?);");