package com.mulesoft.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class TestOracleOpenCursors { public static void main(String[] args) throws Exception { Class.forName("oracle.jdbc.driver.OracleDriver"); // Please replace the following with your own database configuration Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "sean", "welcome1"); Statement statement = connection.createStatement(); // Please replace the following with your own SQL statements ResultSet resultSet = statement.executeQuery("select personid from Persons"); resultSet.close(); statement.close(); System.out.println("sleep for 5 minutes, so that connections in the pool are still maintained, it's time to check on Database end to see the current open cursors"); Thread.sleep(5 * 60 * 1000); connection.close(); System.out.println("done"); } }