如何解决更改会话挂起或导致ORA-01013
我有以下代码块,并且在执行ALTER SESSION
语句时,它挂起或抛出ORA-01013,这取决于我们是连接到Oracle 12r2还是19.3,以及哪个版本的OJDBC8驱动程序正在被使用:
try(Connection connection = jdbcConnection.connect(false)) {
// We Now have a java.sql.Connection open to the database at this point
try(PreparedStatement ps = connection.prepareStatement(someQuery)) {
// We not have a prepared statement based on query,the query is irrelevent
try (Statement s = connection.createStatement()) {
// The following statement fails with the ORA-01013 error
s.execute("ALTER SESSION SET CONTAINER=" + pdbname);
}
}
}
try(Connection connection = jdbcConnection.connect(false)) {
// We Now have a java.sql.Connection open to the database at this point
try (Statement s = connection.createStatement()) {
s.execute("ALTER SESSION SET CONTAINER=" + pdbname);
}
try(PreparedStatement ps = connection.prepareStatement(someQuery)) {
// We not have a prepared statement based on query,the query is irrelevent
}
// or put the alter session here
}
根据我的判断,使用Oracle OJDBC8 12.2.0.1会抛出hang或ORA-01013异常;但是,当我迁移到19.x.0.0时,这就是发生此问题的地方。
这是JDBC驱动程序中的错误吗,还是代码编写方式上确实存在问题,即12.2.0.1驱动程序比以后的版本更宽容?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。