Hi Everybody...
While working on an enterprise application I was making a loop to insert records in the database using a
PreparedStatement in the beginning I forgot the close the prepared statement each time I finish executing the statement and I was inserting the records in a while loop which goes on for like 1000 records.
When trying this I got the exception
Exception ORA-01000 too many open cursorsWhen searching for the cause of the problem I found that oracle creates a new cursor object in the DBMS and because I was not closing prepared statements the cursors was all the time there and they were increasing until they exceed the number defined in the oracle parameter
OPEN_CURSORSI used the following to get the number of open cursors
Code:
SELECT v.value as numopencursors ,s.machine ,s.osuser,s.username
FROM V$SESSTAT v, V$SESSION s
WHERE v.statistic# = 3 and v.sid = s.sid
Finally I solved the problem by creating few prepared statements and just changing the parameters every time I'm gonna execute (which is why there are prepared statements from the first place)
