Olá pessoal,
Estou com o seguinte problema: Os cursores abertos no Oracle nunca são fechados.
Pesquisando no fórum da Oracle a única referência que encontrei é a seguinte:
https://forums.oracle.com/forums/thread.jspa?threadID=685197
Fiz um exemplo que funciona da seguinte maneira:
public class OracleApplicationTest {
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@SERVIDOR:1522:ORCL10", "BUGS", "SENHA");
ResultSet rs = null;
PreparedStatement stmt = con.prepareStatement("select * from tabela");
rs = stmt.executeQuery(); //Abre 1 cursor neste momento.
ResultSet rs2 = null;
PreparedStatement stmt2 = con.prepareStatement("select * from tabela");
rs2 = stmt2.executeQuery(); //Abre 1 cursor neste momento.
ResultSet rs3 = null;
PreparedStatement stmt3 = con.prepareStatement("select * from tabela");
rs3 = stmt3.executeQuery(); //Abre 1 cursor neste momento.
rs3.close();
stmt3.close();
rs2.close();
stmt2.close();
rs.close();
stmt.close();
Runtime rt = Runtime.getRuntime();
rt.gc();
Runtime rt2 = Runtime.getRuntime();
rt2.gc();
Runtime rt3 = Runtime.getRuntime();
rt3.gc();
con.close();
}
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_24-rev-b08 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle Corporation
Implementation-Title: JDBC
Implementation-Version: 11.2.0.2.0
Repository-Id: JAVAVM_11.2.0.2.0_LINUX_100812.1
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0
Main-Class: oracle.jdbc.OracleDriver
sealed: true
Name: oracle/sql/converter/
Sealed: false
Name: oracle/sql/
Sealed: false
Name: oracle/sql/converter_xcharset/
Sealed: false
Alguem já passou por um problema semelhante ? Vamos discutir...