从Java调用PLSQL过程

下面是我的Java程序。 我正在调用PLSQL过程来更新Employee名称。 我关闭了PLSQL代码中的提交,以便我可以从Java代码执行提交和回滚。 但即使在我关闭自动提交并进行显式回滚之后,仍然会在表中更新详细信息。 怎么样? 我不知道,请帮忙。

这是我的Java代码。 在PLSQL中,它只读取值并执行更新语句。 没有提交。

public class TestCommit { public static void main(String[] args) throws SQLException, IOException { CallableStatement callableStatement = null; Connection conn = null; try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); conn = DriverManager .getConnection("jdbc:oracle:thin:testuser/testpwd@//testdb:1521/testbx"); conn.setAutoCommit(false); String sql = "{call testpkg.saveemployee(?,?)}"; callableStatement = conn.prepareCall(sql); callableStatement.setString("name", "spider"); callableStatement.setString("id", "A101"); callableStatement.executeQuery(); conn.rollback(); } catch (Exception ex) { ex.printStackTrace(); } finally { // Close the statement callableStatement.close(); // Close the connection conn.close(); } } } 

编辑:PLSQL

 CREATE OR REPLACE PROCEDURE saveemployee( name IN employee.ename%TYPE, id IN employee.eid%TYPE) IS BEGIN UPDATE employee SET ename = name WHERE eid = id; END; 

我的不好,我正在调用一个错误的程序,在两个不同的包中有两个版本的相同程序,一个有提交,另一个没有提交。 我打电话给那个有提交的人。 现在从两个过程中删除了提交,我的代码现在似乎正常工作。