我们有一个Java工作流应用程序,它使用Oracle数据库来跟踪其步骤以及与其他服务的交互。在工作流程运行期间,会执行多次插入/更新/选择操作,偶尔,即使在成功完成之前运行的插入/更新提交,select也不会返回更新的数据。在工作流程出错后(由于数据不正确),如果我们返回并通过第三方应用程序检查数据库,则会显示新的/更新的数据。当我们的承诺经历和可见时间之间似乎存在滞后。这在大约2%的所有工作流程中都会发生,并且在数据库使用量过大时会增加。Oracle在提交和选择之间存在延迟
我们的数据库支持团队建议的参数最大提交传播延迟更改为0,因为它默认为700这似乎是一个可行的解决方案,但最终还是没有解决我们的问题。
应用程序在WebSphere上运行,并且Oracle数据库被配置为JDBC数据源。我们正在使用Oracle 10.1g。该应用程序是用Java 1.5编写的。
任何帮助,将不胜感激。
编辑:示例代码
DataSource ds; // spring configured
String sql = "INSERT INTO " + currentTable + " (" + stepId + ',' + stepEntryId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepDueDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + ") VALUES (?, ?, ?, null, ?, ?, ?, null, ?, null)";
Connection conn = ds.getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
// set values
stmt.executeUpdate();
// close connections
// later on in the code...
Connection conn = ds.getConnection();
PreparedStatement stmt = null;
ResultSet rset = null;
String sql = "SELECT " + stepId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepDueDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + " FROM " + currentTable + " WHERE " + stepEntryId + " = ?";
stmt = conn.prepareStatement(sql);
stmt.setLong(1, entryId);
rset = stmt.executeQuery();
//close connections
从[Oracle文档](http://download.oracle.com/docs/cd/B14117_01/server.101/b10755/initparams115.htm),似乎参数`max_commit_propagation_delay`仅适用于RAC设置。您是否连接到RAC实例? – 2009-06-11 20:14:58
数据是作为交易的一部分提交的吗?或读? – 2009-06-11 20:16:34