Closed Statement,

Hi,
I am using JDBC8.1.6 thin driver
with Apache Jserv on Sun Solaris 7 box.
I am using PooledConnection to get the connection from the database.
On some of the queries I am getting "Closed Statement" when I am trying to execute them,
although I am getting the connection right before I execute the query.
There is no explicit call to "close()"
between the "prepareStatement()" and
"executeQuery()", nevertheless, I am
getting "Closed Statement" error in about 50%
of all the cases.
Please help me!
Please, CC to [email protected]
Thank you!
Michael Larionov.
The stack trace follows:
java.sql.SQLException: Closed Statement
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:219)
at oracle.jdbc.driver.OracleStatement.ensureOpen(Compiled Code)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Compiled
e)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(Compiled C
at com.sonata.mysonata.edit.consumer.c_home.EnableServiceModule.popul
(Compiled Code)
at com.sonata.delivery.module.AbstractModule.initialize(AbstractModul
ava:233)
at com.sonata.delivery.jsp.SonataJSP.handleCurrentPageInitialization(
ataJSP.java:505)
at com.sonata.delivery.jsp.SonataJSP.service(SonataJSP.java:283)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.gjt.jsp.JspServlet$Page.process(Compiled Code)
at org.gjt.jsp.JspServlet.service(JspServlet.java:284)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.ja
339)
at org.apache.jserv.JServConnection.run(JServConnection.java:202)
at java.lang.Thread.run(Thread.java:479)
null

This could happen if you got another
logical connection after you got the
first one. The spec. says that yoou can't
have more than one logical connection and
the most recent one is the active. So
we remove the connection link to the ones
created earlier.
Please read the JDBC 2.0 optional spec.
for further details.

Similar Messages

  • Closed Statement Exception

    hi,
    I'm using OC4J version "Oracle Application Server Containers for J2EE 10g (9.0.4.3.0) (build 060411.1838)" as my application server running on AIX 5.3 with java version "1.4.1"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
    Classic VM (build 1.4.1, J2RE 1.4.1 IBM AIX build ca1411-20030930 (JIT enabled:
    jitc)).
    Recently i encountered the Closed Statement Exception occasionally, from the stack trace, this exception was thrown during the time i commit the transaction. I wonder is this a bug in the OC4j.jar file ? Please advice me how to overcome this problem. Thanks
    java.sql.SQLException: Closed Statement
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Compiled Code))
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Inlined Compiled Code))
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Inlined Compiled Code))
    at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java(Inlined Compiled Code))
    at oracle.jdbc.driver.OraclePreparedStatement.sendBatch(
    OraclePreparedStatement.java(Compiled Code))
    at oracle.jdbc.driver.OracleConnection.commit(OracleConnection.java(Compiled Code))
    at com.evermind.sql.FilterConnection.commit(FilterConnection.java(Compiled Code))
    at com.evermind.sql.OrionCMTConnection.commit(OrionCMTConnection.java(Compiled Code))
    at com.evermind.sql.ConnectionBCELProxy.commit(ConnectionBCELProxy.java(Compiled Code))

    thanks for the replies, from the stack trace, it seems that the exception is thrown at the time of "commit", but my close statement is put in the finally block, so there is no way the connection is closed and recently this exception just disappear without changing code.

  • Oracle :Closed statement exception

    Hi,
    Iam trying to migrate a j2ee application to NetWeaver. Iam getting Oracele closed statement exception while executing a code which works fine with other servers like weblogic and jboss. My code is some thing like this
    stmt = con.prepareStatement
    result = stmt.executequery
    if(result.next())
    working_fine = result.getString("something");
    callInsertMethod(con);
    con.commit();
    <b>not_working_fine = result.getString("somethingelse")</b>
    I am getting this exception at the above bolded line. iam calling another method where some database insertions and al happen and connection commit also happens.Any help?

    Sujesh,
    if I understood correctly, you're calling bothe some instertions + commit in the method <b>callInsertMethod(con)</b> before the emphasised line is called. As far as my experience tells me, that's not ok, because a commit might clear/close other result sets on the same connection. For the code snippet you've posted I'd say just move the emphasized line before <b>callInsertMethod(con)</b>.
    Additionally I'd suggest to explicitly close the statement (the result set too if you're not relying on driver JDBC compliance) and if <b>callInsertMethod(con)</b> already commits, to delete the <b>con.commit()</b>.
    Btw., the JavaDoc should be your best friend, here a detail from java.sql.Connection.commit():
    Makes all changes made since the previous commit/rollback permanent and <b>releases any database locks</b> currently held by this Connection object.

  • Weblogic JTA timeout and PreparedStatement cache problem (Closed Statement)

    Hello,
    I am facing up a problem using a Weblogic connection pool with a PreparedStatement.
    Here is the environement :
    - Weblogic application server 10.3
    - JDBC connection pool with Oracle Thin driver (from server library) - all parameters by default i.e. StatementCache size = 10
    - JTA transaction timeout = 30s
    The problem is : if a prepared statement ends because of a JTA timeout, I receive the following stack exception/ stack trace
    java.sql.SQLException: The transaction is no longer active - status: 'Rolling Back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 33 seconds
    BEA1-000D8AE7230EFAA3EDC9]'. No further JDBC access is allowed within this transaction.
    at weblogic.jdbc.wrapper.JTSConnection.checkIfRolledBack(JTSConnection.java:178)
    at weblogic.jdbc.wrapper.JTSConnection.checkConnection(JTSConnection.java:188)
    at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:92)
    at weblogic.jdbc.wrapper.Connection.clearCachedStatement(Connection.java:814)
    at weblogic.jdbc.wrapper.PreparedStatement.clearCachedStatement(PreparedStatement.java:1357)
    and then, if we try to re-execute immediately the same operation (*same statement* but new request, new thread, new JTA transaction ...) we receive without delay the following exception :
    java.sql.SQLException: Closed Statement
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    It seems like a bug in the caching mechanism of Weblogic, the 1st stack trace shows method from the statement cache implementation, I presume weblogic is trying the clear the statement from the cache after the iniitial TimedOutException (SQLException), but as the JDBC connection is unusable at this point, the clearing fails and the statement remains in the cache but is physically closed by JDBC.
    1st question, why weblogic does need to call JTSConnection.checkConnection() for clearing a statement from its internal cache, it is a pure java memory operation isnt'it ?
    2nd question : How to solve the problem without setting the StatementCache size to 0 (I tried, it solves the problem)? I don't want to disable completely the Weblogic statement caching, I have a small PreparedStatement called very frequently.
    Thanks for any help

    The main issue is that the transactional context that is supposed to underlay the JDBC code being executed,
    has gone away. Indeed, any DBMS changes that may have been made by your code so far, have been rolled
    back and are gone. Your code should not be trying to continue JDBC as normal, and WebLogic is trying to stop
    you. The control flow should go back up to the location where the transaction was initiated, so as to restart from
    the beginning if that is what is desired, including getting a new JDBC connection and remaking all the statements
    etc.
    HTH,
    Joe
    Edited by: Joe Weinstein on Dec 3, 2010 9:12 AM

  • Connection pooling in multithreaded app results in occasional "Closed Statement" exc"

    Hi there,
    I'm writing a CORBA servant, which amongst all calls in a stored procedure. I'm using connection pooling (just by example) from multiple threads and use grabbed connection to prepare an SP statement, execute it, and close both statement and connection (to return it to the pool). My stress tests run fine for the most part but once in a while throws out "Closed Statement" exception when trying to excecute the prepared statement.
    The reference platform is Solaris7, thin driver 8.1.6 for Java2, jdk 1.2.2, Oracle 8.1.5 (backend), ORBacus 3.3 (external application orb).
    Do you guys have any "multithreaded" statements as far as pooling concerned? Let me know if you need code, schema, anything at all. Any recommendations are greatly appreciated too, like "don't use prepared statements, don't use pooling from multiple threads, download upgrade, etc". Thanks ahead.
    Yours,
    -Evgeni

    Dear Oracle JDBC Development Team,
    First of all, I object to your comment "Please don't spread wrong information.". I do not spread wrong information. That is why I wrote in my previous email, "it isn't thread safe (as far as my tests have shown)". My statement is thus conditional on MY testing. I recognise the fact that I could be wrong. Hence, the conditional clause.
    As for the claim that OracleConnectionCacheImpl is thread safe - well, since it is your software then all I can do is believe you. However, I repeatedly get a java.util.EmptyStackException from calls to oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection() when running my test WITHOUT using the "synchronized" clause on the OracleConnectionCacheImpl object.
    This, of course, could be due to the fact that my test is faulty. I don't know. I can't see the fault in any case. If you can help me with this then I would be more than grateful.
    In any case, when I use the "synchronized" statement on OracleConnectionCacheImpl then this error disappears in a multithreaded environment.
    Another interesting thing my test showed was that the JDBC driver seems to hang under heavy workload. Again, I could be WRONG. It could be my test that causes the problem, however, it is very hard to pinpoint the problem.
    I would really appreciate help with this, if you have time, as we are using OracleConnectionCacheImpl in a major Internet billing system. If you wish to help then please send me an email to [email protected] (or [email protected]) and I will then send you my source code for the test.
    In any case, I will word my messages with even more care in future!
    regards,
    Alexander Day
    null

  • Content Switching Module (CSM): Sessions stuck in closing state

    Hi guys,
    I'm troubleshooting a CSM with 4.3(1).
    We migrated a real server from windows to linux, since then lot's of sessions stuck in closing state until the idle timer expires.
    I traced the traffic from the client to the csm and from the csm to the real server what I saw is the following behaviour at the end of a session:
    windows real server: client sends FIN -> real server acks the FIN -> real server sends FIN -> client sends RST -> real server sends RST -> CSM deletes session from session table
    The linux real server mostly behaves like the windows real server but sometimes behaves as follows:
    client sends FIN -> real server sends  FIN, but does not ack the FIN sequence number of the client -> real server sends RST -> client sends RST -> CSM does not delete  session from session table, it stucks in closing state
    Does anybody know how I can solve this problem of half-closed sessions other than decreasing the idle timeout?
    Is it possible to configure CSM to close and delete sessions not only on FIN-ACK packets but also on RST packets?
    Or to use a different fast idle timeout when sessions are half-closed?
    Many thanks in advance,
    Thorsten

    Hi Fabrizio,
    CSM_FAST_FIN_TIMEOUT is already set to 10 seconds.
    What I found out while testing is that CSM_FAST_FIN_TIMEOUT works with configurations where idle timeout is configured > 0.
    But when idle timeout is configured to 0 (what meas no idle timeout) the csm seems not to use CSM_FAST_FIN_TIMEOUT: Half closed sessions will stuck in closing state.
    Any idea why cms behaves this way?
    Regards,
    Thorsten

  • Interleaved executeQuery's intermittant SQLException: Closed Statement

    When i run the following code using JDK1.3.1 and Oracle 817 i see the line "cats_rs = cats_stmt.executeQuery();" throw a "SQLException: Closed Statement." about 1 out of 10 times.
    All variables, except the connection, are local. the statement example below are just 2 among dozens of others - all using the same connection.
    Any ideas why i'd get an intermittant exception like this?
    It is totally stumping me. thanks in advance.
    memory_stmt = connection.prepareStatement(memory_sql,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    cats_stmt = connection.prepareStatement(cats_sql,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    index = 1;
    memory_stmt.setString(index++, host);
    memory_stmt.setString(index++, jvm);
    memory_stmt.setLong(index++, starttime);
    memory_stmt.setLong(index++, endtime);
    memory_rs = memory_stmt.executeQuery();
    index = 1;
    cats_stmt.setString(index++, host);
    cats_stmt.setString(index++, jvm);
    cats_stmt.setLong(index++, starttime);
    cats_stmt.setLong(index++, endtime);
    cats_rs = cats_stmt.executeQuery();
    E.g.
    java.sql.SQLException: Closed Statement
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
         at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:5681)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:409)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:366)
    Thx, Tim

    I had a hunch that this was a limitation or bug in the driver or pool. I also read in forums that the connection "manages" each Statement it prepares or creates; like it adds it to a List and such ; it also cleans the slate each time the connection is closed.
    This code example above is just a small snippit that summarizes over a long time range of data (like days) - that is potentially 1000s of statements and queries and result sets.
    It is probably not very common that with jdbc someone prepares and executes 1000s of queries on the same connection over a course of 2 - 10 minutes (that's how long the entire operationcould take). I guessed the connection was worn out and tired .
    I changed the code to get a connection and then close the connection periodically - instead of getting one connection and using it for the whole period. After that all these hard to explain Closed Statement exceptions disappeared.
    i think the interleaving queries is OK. I guess the connection was blowing out.

  • Interleaved executeQuery() generates SQLException: Closed Statement

    When i run the following code i see the cats_stmt.executeQuery() line throw a "SQLException: Closed Statement.".
    Since I just created the cats_stmt statement - why could it be closed?
    The memory_stmt.executeQuery runs without exception.
    memory_stmt = connection.prepareStatement(memory_sql,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    cats_stmt = connection.prepareStatement(cats_sql,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    index = 1;
    memory_stmt.setString(index++, host);
    memory_stmt.setString(index++, jvm);
    memory_stmt.setLong(index++, starttime);
    memory_stmt.setLong(index++, endtime);
    memory_rs = memory_stmt.executeQuery();
    index = 1;
    cats_stmt.setString(index++, host);
    cats_stmt.setString(index++, jvm);
    cats_stmt.setLong(index++, starttime);
    cats_stmt.setLong(index++, endtime);
    cats_rs = cats_stmt.executeQuery(); <<- throws exception.
    On JDK1.3.1 and Oracle 817
    E.g.
    java.sql.SQLException: Closed Statement
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
    at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:5681)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:409)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:366)

    I had a hunch that this was a limitation or bug in the driver or pool. I also read in forums that the connection "manages" each Statement it prepares or creates; like it adds it to a List and such ; it also cleans the slate each time the connection is closed.
    This code example above is just a small snippit that summarizes over a long time range of data (like days) - that is potentially 1000s of statements and queries and result sets.
    It is probably not very common that with jdbc someone prepares and executes 1000s of queries on the same connection over a course of 2 - 10 minutes (that's how long the entire operationcould take). I guessed the connection was worn out and tired .
    I changed the code to get a connection and then close the connection periodically - instead of getting one connection and using it for the whole period. After that all these hard to explain Closed Statement exceptions disappeared.
    i think the interleaving queries is OK. I guess the connection was blowing out.

  • Jboss getting SQLException: Closed Statement prepared-statement- cache-size

    My first post in this forum , hope to get a quick resolution :)
    I am using Jboss 4.0.0 on Oracle 9.2.0.4.0
    In order to improve the app performance , I had specified prepared-statement-cache-size as 50 as follows ,
    <datasources>
    <local-tx-datasource>
    <jndi-name>jdbc/sct</jndi-name> <connection-url>jdbc:oracle:thin:@confidential:1560:sct1</connection-url>
    <user-name>Confidential</user-name>
    <password>Confidential</password>
    <min-pool-size>10</min-pool-size>
    <max-pool-size>120</max-pool-size>     <prepared-statement-cache-size>50</prepared-statement-cache-size>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptio nSorter</exception-sorter-class-name>
    <idle-timeout-minutes>5</idle-timeout-minutes>
    <track-statements>true</track-statements>
    <new-connection-sql>select sysdate from dual</new-connection-sql>
    <check-valid-connection-sql>select sysdate from dual</check-valid-connection-sql>
    </local-tx-datasource>
    </datasources>
    After doing this , I start getting the following exception ,
    java.sql.SQLException: Closed Statement
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
         at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:5681)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.j ava:409)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.ja va:366)
         at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeQuery(CachedPrepare dStatement.java:57)
         at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPrepa redStatement.java:296)
         at com.ge.sct.SiteText.getSiteTextFromDB(SiteText.java:292)
    Thanks in Advance
    Bhavin

    Hello,
    I am also facing the same error: somewhere just now I read,
    We were getting this error on JBoss / Oracle. The fix was setting the following to 0 in oracle-ds.xml:
    <prepared-statement-cache-size>0</prepared-statement-cache-size>
    Ref: http://www.jpox.org/servlet/forum/viewthread?thread=1108
    May be you can try this, I am also still finding the solution, I will try the above and let u know, if i get success.
    Regards,
    Rajesh

  • Java.sql.SQLException: Closed Statement

    I'm having a problem with my Java code trying to access an Oracle 10g database through the JDBC driver using the Oracle XML Publisher.
    We generate a number of different reports, but one report consistently fails with the error: java.sql.SQLException: Closed Statement
    It only happens in the production environment, which has significantly more data than the test and development environments.
    One interesting (!) observation is that the error occurs after 10 minutes to the second (almost). Which leads me to think it is a timeout related problem, but am aware that this could be a red herring.
    And finally, the code is being run within a job sheduled using the Quartz Scheduler v1.6.5.
    Any help would be appreciated.
    Many Thanks
    Lawrence
    Here is the stack trace:
    java.sql.SQLException: Closed Statement: getMetaData
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:128)
    at com.mchange.v2.c3p0.impl.NewProxyResultSet.getMetaData(NewProxyResultSet.java:47)
    at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processXML(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(Unknown Source)
    at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(Unknown Source)
    at oracle.apps.xdo.dataengine.DataProcessor.processData(Unknown Source)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateXML(InvoiceFileFactory.java:157)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateStatements(InvoiceFileFactory.java:365)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateInvoices(InvoiceFileFactory.java:457)
    at com.tmobile.sett.file.invoice.StatementGeneratorJob.execute(StatementGeneratorJob.java:34)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Here is the code:
    private void generateXML(String xmlTemplate, String xmlFilename, Hashtable parameters) {
    DataProcessor dataProcessor = new DataProcessor();
    log.debug("generateXML: xmlTemplate {}, xmlFilename {}", xmlTemplate, xmlFilename);
    try {
    // Set Data Template to be executed
    dataProcessor.setDataTemplate(xmlTemplate);
    // Obtain a new Connection from the Pool
    Connection conn = HibernateUtil.getConnection();
    if (conn == null)
    log.debug("conn is null after getCall");
    if (conn.isClosed())
    log.debug("conn is closed after getCall");
    // Set the Connection for the dataProcessor
    dataProcessor.setConnection(conn);
    if (conn.isClosed())
    log.debug("conn is closed after setConnection");
    dataProcessor.setParameters(parameters);
    if (conn.isClosed())
    log.debug("conn is closed after setParameters");
    // Specify the output directory and file for the data file
    dataProcessor.setOutput(xmlFilename);
    if (conn.isClosed())
    log.debug("conn is closed after setOutput");
    // Process the data template
    dataProcessor.processData();
    if (conn.isClosed())
    log.debug("conn is closed after processData");
    // Return the connection to the pool
    conn.close();
    } catch (Exception e) {
    System.err.println("Error generating XML with the following parameters:");
    System.err.println("xmlTemplate=" + xmlTemplate);
    System.err.println("xmlFilename=" + xmlFilename);
    System.err.println("Here's the stack trace");
    e.printStackTrace();
    System.exit(1);
    }

    I have made some progress in understanding the problem...
    Basically, your comment about threads made me look at the code from a threads perspective. There are only three objects used, log4j, oracleXML Publisher and hibernate. Discounting log4j, the Oracle object is created, opened and closed within the procedure, so I concluded that hibernate was the most likely cause of the problem (i know, theres an element of educated guesswork in this).
    Anyway, I found the hibernate timeouts (all around 300 seconds) and increased them to 3000 seconds... and lo and behold the reports are generated successfully, although some of them take over 20 minutes each.
    So, this is a performance problem with the SQL itself:
    SELECT service
    , reply
    , ROUND(SUM(DECODE(op, 3, 0, count))* :uplift,0) x_events
    , ROUND(SUM(DECODE(op, 3, count, 0))* :uplift,0) y_events
    FROM aggregate
    WHERE ref_time >= :period_start
    AND ref_time < :period_end
    AND feed = 13
    AND agreement = :agreement
    AND line = 1
    GROUP BY service, reply
    ORDER BY 1,2
    The SQL in question is querying data for a specific month from a monthly partitioned table that contains about 11 million records a month. We currently have 99 partitions.
    Executing the sql in Toad / Sql developer / sqlplus takes around 20 seconds...so why 20 minutes?
    Looking in the session browser, I can see that the 20 minute query is looking through all 99 partitions where the 20 second query is only looking at 1 partition for the month in question.
    I'm not sure if this is heading off topic for the forum thread, but the question now is...
    Why is Oracle using a clearly innefficient execution plan when we are using a query with bound variables and how do we get it to use a more efficient execution plan?

  • Closing Statements and ResultSets

    I just recently realized that you need to close Statements and ResultSets in order to avoid getting the "Too many cursors"-message.
    My question is:
    Do you need to close both Statements and ResultSets?
    - not that it's a problem...
    if so:
    Does it matter which one you close first?

    I usually place the stmt.close() code in my finally block, to ensure that the statement gets closed, even if a SQLException occurs during the query/update. The ResultSet does not explicitly have to be closed, ... it is automatically closed when the Statement is closed, or if a new query is run on the same statement.

  • Automatically closing statements

    Hi. Is there a way to automatically close all statements and ResultSets associated with a Connection if all you have is the Connection? (without closing the Connection)
    Thanks.

    No, but you can make one. Subclass or wrap Connection, and every time a statement is requested, keep a reference to it. Then you can just iterate through all your references and close them.

  • Creating and closing statements

    Hi
    I am new 2 JDBC and have a few doubts,
    I need 2 move forward and backwards in the resultset, i am using the following declaration for that
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    can i use the same declaration for the resultsets where i only need 2 move forward?
    also i use different functions for running different queries, should i create n close statements seperately in each function, or should i create statement once n for all wen im loading the driver and use that in all da functions?
    thanks a ton!

    You can use it but before using it for second time. you have to make it null.No. No. No. Setting it to null does nothing particularly good for you. it makes the object eligible for garbage collection, which is going to happen anyway as soon as the Statement is reused.
    You need to call close() before reusing a Statement (or PreparedStatement).
    If your code has any chance of ever being used in a multi-threaded environment (such as a web service), then you should use local Statement objects. There are also a lot of good design reasons for making them local, but for a single-threaded application, you certainly could use a single global Statement.

  • Open an accordion widget in the closed state?

    I have searched the forums but have yet to find a resolution
    for this issue. I am using an accordion widget and would like for
    all of my panels to appear closed when the page initially loads.
    Only once the user has clicked the tab do I want the panels to
    open. Any suggestions that do not require me to buy a separate plug
    in? Thanks.

    This is directly from the Adobe documentation:
    http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#AllPanelsCl osed
    However, one thing to keep in mind is that this is assuming
    that you are using the 1.6.1 update (as that is what the references
    refer to). If you have never updated your Spry this would be a good
    opportunity to do so. The below is the to the official Spry
    homepage. There you will find the update package which includes
    some samples and an Extension. Install the extension and restart
    DW. Then under the Sites menu you will see a new option to update
    Spry. Run that script and your Spry will be updated. Also on that
    homepage is a link to the official Spry forums:
    http://labs.adobe.com/technologies/spry/home.html

  • How do I get Firefox to open from a closed state when I click on a URL sent in an email or posted in a chat forum?

    When Firefox is off and I click on a URL link, Firefox does not start up and open at the URL link. When Firefox is on and I click on a link, then Firefox will start (open) another tab for the URL link. Firefox should open the link regardless of it's on/off state. Windows IE does this and I would expect Firefox to also do this.
    Also, related to this is the fact that if I am at a website in Firefox and need to print out a PDF document shown on the website, I can't do this unless I first open/start Adobe. Adobe should automatically start as soon as I try to open the PDF document; again, IE does this.

    Cor-el,
    Thank you for the response. I’ve already selected Adobe Reader in Firefox as the viewer for PDF documents based on the response I got earlier from the-edmeister. Firefox will still not open a PDF document from a website when viewing the website in Firefox.
    As far as changing anything in a dot config file – I’ll pass. I’ve been a Windows IE user for more years than I can remember. I’ve been told by many other folks that Firefox is a better browser platform for several years. Based on that, I assumed that Firefox will do everything that IE will do as good as or better than IE. I’m not opposed to making some application based selections to get Firefox to work, but I was expecting a fully functional plug & play application. Changing settings in dot config files is not my idea of plug & play.
    I printed out the instructions from the link you supplied (https://support.mozilla.org/kb/view-pdf-files-firefox-without-downloading-them) and will give that a shot later today. In the mean time, I’ve already redone the default browser setting and temporarily set IE as the default browser.

Maybe you are looking for