Ranjith, nice to know that you are also a part of the mailing list :). some reasons why you get this error: --> you forgot to close the Resultset and Statement Object. (with Oracle there is not surity, that an implicit close from the Objects occur, when the connection is closed! --> an exception in the query is raised and the exceptionhandling does not close the ResultSet and Statement --> the garbagecollection don't free all Objects (ResultSet, Statement)
Actually Adrian is right. Its better to have a finally block (This is the best way i had solved the problem) in your programs and the connection and resultsets be checked once more in the finally block that they are closed. Its advised to assign Resultset, Statement, Connection to null. Ex: rs.close(); rs = null; In database level, you can do this : set OPEN CURSERS = 500 Regards, Vikram. -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ranjith Chakravarthi Sent: Wednesday, January 29, 2003 4:46 PM To: [EMAIL PROTECTED] Subject: Re: odd oracle error [MAX cursors] it is a nice way but, it leaves the implementation of the try catch to be done by each developer and this could turn into a big loop hole. vikramjeet had done something much better than just leaving each developer to manage the oracle resources by themselves. hey vikram, plz ...... -----Original Message----- From: Adrian Janssen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 3:11 AM To: [EMAIL PROTECTED] Subject: Re: odd oracle error We used to get this too and fixed it by making sure that any Statements and ResultSets we create are explicitly closed in finally blocks. It appears that these objects hold a cursor open while they live (one or the other or both, not too sure so I manage both). What we now do in fact is manage them as rigorously as we do transactions and anywhere we create either, we immediately start a "try" block and ensure that the they are closed in the "finally" - this required a bit re-architecting to ensure that all the "close" calls could be done in the same block of code. Cheers Adrian > -----Original Message----- > From: Cosmin Cremarenco [SMTP:[EMAIL PROTECTED]] > Sent: 29 January 2003 12:37 > To: [EMAIL PROTECTED] > Subject: odd oracle error > > hello > at rare, random times we get the following error from our oracle 8i server > (8.1.7): > java.sql.SQLException: ORA-01000: maximum open cursors exceeded > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168) > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208) > at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118) > at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:466) > at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:413) > at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:432) > at > oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement. > ja > va:182) > at > oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement. > ja > va:165) > at > oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnecti > on > .java:608) > at > oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java > :4 > 89) > at extranet.wb.WUpdate.selectUpdates(WUpdate.java:93) > at org.apache.jsp.whatisnew_jsp._jspService(whatisnew_jsp.java:1184) > at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java > :2 > 02) > at > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati > on > FilterChain.java:247) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter > Ch > ain.java:193) > at > geweb.control.filters.NoCacheFilterJsp.doFilter(NoCacheFilterJsp.java:43) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati > on > FilterChain.java:213) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter > Ch > ain.java:193) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. > ja > va:260) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:643) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 > ) > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. > ja > va:191) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:643) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 > ) > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > at > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1 > 80 > ) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:643) > at > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValv > e. > java:170) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:641) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1 > 71 > ) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:641) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 > ) > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja > va > :174) > at > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv > ok > eNext(StandardPipeline.java:643) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 > ) > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) > at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458) > at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551) > at java.lang.Thread.run(Thread.java:536) > > before anything I must say that we do close all our PreparedStatement, but > not the ResultSet. > AFAIK not closing the ResultSet shouldn't be a problem. We even had some > tests on this issue and they were successfull. > the maximum open cursors in our init.ora is 300 and we are using tomcat > 4.1.12 > > thanks, > cosmin > > __________________________________________________________________________ > _ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html -- It is the strict policy of Truworths that its e-mail facility and all e-mail communications emanating therefrom, should be utilised for business purposes only and should conform to high professional and business standards. Truworths has stipulated certain regulations in terms whereof strict guidelines relating to the use and content of e-mail communications are laid down. The use of the Truworths e-mail facility is not permitted for the distribution of chain letters or offensive mail of any nature whatsoever. Truworths hereby distances itself from and accepts no liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for other than strictly business purposes. Truworths furthermore disclaims liability for any unauthorised instruction for which permission was not granted. Truworths Limited accepts no liability for any consequences arising from or as a result of reliance on this message unless it is in respect of bona fide Truworths business for which proper authorisation has been granted. Any recipient of an unacceptable communication, a chain letter or offensive material of any nature is requested to notify the Truworths e-mail administrator ([EMAIL PROTECTED]) immediately in order that appropriate action can be taken against the individual concerned. ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html Disclaimer: This e-mail message along with any attachments is intended only for the addressee and may contain confidential and privileged information of GTL Limited. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system. ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html