我有这样的情况,即我使用的第3个政党开放源产品从Oracle的 cur子中挥发,并收到错误:java.sql.SQLException: ORA-01000:最大开场治疗器超过顶
我的最高治标人定为1,000人,如果达到这一限制的守则不正确,或者如果我只需要增加我的限额,我就试图指出这一点。
进行了一些调查 我在《法典》中看到了设立“ResultSet”的一点,从而把我的开张 cur子增加到1。 然而,该ResultSet在使用后很快就关闭了......BUT, cur子仍留在原地。 在第三党开放源项目之外,我得以在简便的JDBC应用中复制这一逻辑。
package gov.nyc.doitt.cursor;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CursorTest {
public static void main(String[] args) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@myhost:1537:mydb", "username", "password");
// as expected: there are 0 cursors associated with my session at this point
ps = conn.prepareStatement("select my_column from my_table where my_id = ?");
ps.setInt(1, 86);
// as expected: there are 0 cursors associated with my session at this point
rs = ps.executeQuery(); // opens 1 cursor
// as expected: there is 1 open cursor associated with my session at this point
} catch (Throwable t) {
t.printStackTrace();
} finally {
// as expected: there is 1 open cursor associated with my session at this point
try {
rs.close();
} catch (SQLException e) {
System.err.println("Unable to close rs");
}
// not expected: there is still 1 open cursor associated with my session at this point
try {
ps.close();
} catch (SQLException e) {
System.err.println("Unable to close simplePs");
}
// not expected: there is still 1 open cursor associated with my session at this point
try {
conn.close();
} catch (SQLException e) {
System.err.println("Unable to close conn");
}
// as expected: at this point my session is dead and so are all the associated cursors
}
}
}
我发现一些Oracle文件,使我想,如果你关闭我们的ResultSet和编写声明,所有开张的治疗师都将关闭,但我的开张治疗师似乎正在hang。 See this FAQ ( http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/basic.htm#1006509 后者说,“公布结果集或声明释放了数据库中相应的 cur”。 我的检验似乎没有发生,因此我必须缺乏一些基本的理解。
谁能解释一下Oracle如何处理 cur子,或者把我引向一些将给我开明的文件?
感谢!