【发布时间】:2011-12-16 12:54:13
【问题描述】:
我编写了一个用于插入当前日期的 java 代码,但是当我尝试运行它时出现异常:
public void Session_Table_Update (String Update_User) throws SQLException{
String SQL_Statement = null;
error_Message = null;
if (ds == null) throw new SQLException( error_Database = "No data source");
Connection conn = ds.getConnection();
if (conn == null) throw new SQLException( error_Database = "No connection");
try {
conn.setAutoCommit(false);
boolean committed = false;
try {
SQL_Statement = "INSERT INTO USERS (LAST_LOGIN) VALUES (?,?,?) WHERE USERZ ="+ Update_User;
PreparedStatement insertQuery = conn.prepareStatement(SQL_Statement);
insertQuery.setString(3, "2.2.2011");
insertQuery.executeUpdate();
conn.commit();
committed = true;
} finally {
if (!committed) conn.rollback();
}
}
finally {
conn.close();
}
return;
}
你能帮我解决这个问题吗?
【问题讨论】:
-
更重要的是,你得到了什么例外?它们通常包含完整的答案。
-
javax.servlet.ServletException: java.sql.SQLException: 索引处缺少 IN 或 OUT 参数:: 1 javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)