Getting ORA-01000: maximum open cursors exceeded from Java Application. I checked also, after every iteration, the cusrsor size keep on increasing. At some point of time, when it exceeds the max cusrsor size getting the exception.
public void processData(List<String> list)
{
PreparedStatement pstmt = null;
ResultSet resultData = null;
Connection conn = myConnection.getConnection();
for( int i=0; i<list.size(); i++)
{
try {
String sqlQuery = list.get(i);
PreparedStatement pstmt = conn.prepareStatement(sqlQuery, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet resultData = pstmt.executeQuery();
// Then processing the data.
} catch (Exception e) {
e.printStackTrace();
}
finally {
if( resultData != null )
resultData.close();
if( pstmt != null)
pstmt.close();
}
}
}
I have multiple jvm instances and utilizing the same connections. After every closing of resultset and statement, still the cursor size keeps on increasing. When I am running more than 5 jvm instances, getting the same error. But its not consistent.