private Connection conn = DriverManager.getConnection(URL, info);
try {
String sql = "INSERT INTO \"STUD1582251\".\"ACCOUNTS\" VALUES USERNAME=?, PASSWORD=?, PORTFOLIONAME=?";
PreparedStatement stm = conn.prepareStatement(sql);
stm.setString(1, user.getUsername());
stm.setString(2, user.getPassword());
stm.setString(3, user.getPortfolioName());
System.out.println(sql);
stm.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
Exception
异常
SELECT username FROM "STUD1582251"."ACCOUNTS" WHERE username=? INSERT INTO "STUD1582251"."ACCOUNTS" VALUES USERNAME=?, PASSWORD=?, PORTFOLIONAME=? java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
选择用户名从“STUD1582251”。“账户”用户名= ?插入“STUD1582251”。“账户”值的用户名= ?密码= ?PORTFOLIONAME = ?java.sql。SQLSyntaxErrorException: ORA-00933: SQL命令未正确结束
1 个解决方案
#1
7
INSERT SQL statement must be:
插入SQL语句必须为:
String sql = "INSERT INTO \"STUD1582251\".\"ACCOUNTS\" (USERNAME,PASSWORD,PORTFOLIONAME) VALUES (?,?,?)";
PS: Use " (double quotes) around identifier if it is a reserved word.
如果标识符是一个保留字,则使用“(双引号)”。
#1
7
INSERT SQL statement must be:
插入SQL语句必须为:
String sql = "INSERT INTO \"STUD1582251\".\"ACCOUNTS\" (USERNAME,PASSWORD,PORTFOLIONAME) VALUES (?,?,?)";
PS: Use " (double quotes) around identifier if it is a reserved word.
如果标识符是一个保留字,则使用“(双引号)”。