Gor The result set is closed after switch to latest microsoft JDBC driver

The same code works fine with the previous version of the microsoft JDBC driver, but throws
com.microsoft.sqlserver.jdbc.SQLServerException: The result set is closed.
for the JDBC driver 4.
Please Help!
Thanks.

I found the same exception when dealing with ResultSetMetaData.
Using the old driver (1.2.2828.100) it was possible to do something like:
Statement s = con.createStatement();
ResultSet r = s.executeQuery("select * from <table>");
ResultSetMetaData m = r.getMetaData();
r.close();
s.close();
int numCols = m.getColumnCount();
But using the new driver (2.0.1803.100) it complains that the result set is closed.
The solution was to keep the ResultSet and Statement open until after the ResultSetMetaData is no longer needed. It is somewhat inconvenient because before it was possible to have a utility method that would return a ResultSetMetaData object and not have to worry about keeping the Statement and ResultSet objects around.
I was hoping for a speed increase for batch inserts by having the latest driver, sadly there is no performance gain.

Similar Messages

  • Statement.close() Not closing the Result set

    Hi all,
    I have the following code which invokes a procedure in Oracle database
    public static callProcedure(Connection connection,String procedure){
    ResultSet resultSet = null;
    CallableStatement callableStatement = null;
    try {
    callableStatement = connection.prepareCall(procedure);
    callableStatement.registerOutParameter(1,OracleTypes.CURSOR);
    callableStatement.execute();
    resultSet =((OracleCallableStatement)callableStatement).getCursor(1);
    } catch (Exception exception) {
    exception.printStackTrace();
    } finally {
    try {
    callableStatement.close();
    } catch (SQLException sqlException) {
    sqlException.printStackTrace()
    return resultSet;
    Ideally if i try to iterate through the result set which is returned then it should give me resultset closed as i am closing the resultset. But this is not happening.
    Please anybody can explain the isue

    Hi,
    That is not easy to explain, I might take a guess and say that a statement cache is being used therefore the statement is not actually being closed.
    I always close the reultset then the statement so wouldn't notice this behaviour.
    Why are you returning a resultset anyway? If you really need to do this I would suggest using a disconnected resultset:
    OracleCachedRowSet ocrs = new OracleCachedRowSet();
    ocrs.populate(resultSet);
    return ocrs;

  • RDBMS Event Generator Issue - JDBC Result Set Already Closed

    All -
    I am having a problem with an RDBMS event generator that has been exposed by our Load Testing. It seems that after the database is under load I get the following exception trace:
    <Aug 7, 2007 4:33:06 PM EDT> <Info> <EJB> <BEA-010213> <Message-Driven EJB: PollerMDB_SessionRqt_1186515408009's transaction was rolledback. The transact ion details are: Xid=BEA1-7F8C65474500D80A5B94(218826722),Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException],numRepli esOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=60,XAServerResourceInfo[JMS_Affinity_cgJMSStore_auto_1]=(ServerResourceInfo[JMS_Affi    nity_cgJMSStore_auto_1]=(state=rolledback,assigned=wli_int_1),xar=JMS_Affinity_cgJMSStore_auto_1,re-Registered = false),XAServerResourceInfo[ACS.Telcordi    a.XA.Pool]=(ServerResourceInfo[ACS.Telcordia.XA.Pool]=(state=rolledback,assigned=wli_int_1),xar=ACS.Telcordia.XA.Pool,re-Registered = false),XAServerReso urceInfo[JMS_Affinity_cgJMSStore_auto_2]=(ServerResourceInfo[JMS_Affinity_cgJMSStore_auto_2]=(state=rolledback,assigned=wli_int_2),xar=null,re-Registered = false),SCInfo[wli_int_domain+wli_int_2]=(state=rolledback),SCInfo[wli_int_domain+wli_int_1]=(state=rolledback),properties=({START_AND_END_THREAD_EQUAL    =false}),local properties=({weblogic.jdbc.jta.ACS.Telcordia.XA.Pool=weblogic.jdbc.wrapper.TxInfo@d0b2687}),OwnerTransactionManager=ServerTM[ServerCoordin    atorDescriptor=(CoordinatorURL=wli_int_1+128.241.233.85:8101+wli_int_domain+t3+, XAResources={weblogic.jdbc.wrapper.JTSXAResourceImpl, Affinity_cgPool, J    MS_Affinity_cgJMSStore_auto_1, ACSDispatcherCP_XA, ACS.Dispatcher.RDBMS.Pool, ACS.Telcordia.XA.Pool},NonXAResources={})],CoordinatorURL=wli_int_1+128.241 .233.85:8101+wli_int_domain+t3+).>
    <Aug 7, 2007 4:33:06 PM EDT> <Warning> <EJB> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception was:
    javax.ejb.EJBException: Error occurred while processing message received by this MDB. This MDB instance will be discarded after cleanup; nested exceptio n is: java.lang.Exception: Error occurred while preparing messages for Publication or while Publishing messages.
    javax.ejb.EJBException: Error occurred while processing message received by this MDB. This MDB instance will be discarded after cleanup; nested exception is: java.lang.Exception: Error occurred while preparing messages for Publication or while Publishing messages
    java.lang.Exception: Error occurred while preparing messages for Publication or while Publishing messages
    at com.bea.wli.mbconnector.rdbms.intrusive.RDBMSIntrusiveQryMDB.fetchUsingResultSet(RDBMSIntrusiveQryMDB.java:561)
    at com.bea.wli.mbconnector.rdbms.intrusive.RDBMSIntrusiveQryMDB.onMessage(RDBMSIntrusiveQryMDB.java:310)
    at weblogic.ejb20.internal.MDListener.execute(MDListener.java:400)
    at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:333)
    at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:298)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2698)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2523)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Caused by: java.sql.SQLException: Result set already closed
    at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:105)
    at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:67)
    at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next()Z(Unknown Source)
    at com.bea.wli.mbconnector.rdbms.intrusive.RDBMSIntrusiveQryMDB.handleResultSet(RDBMSIntrusiveQryMDB.java:611)
    at com.bea.wli.mbconnector.rdbms.intrusive.RDBMSIntrusiveQryMDB.fetchUsingResultSet(RDBMSIntrusiveQryMDB.java:514)
    ... 8 more
    javax.ejb.EJBException: Error occurred while processing message received by this MDB. This MDB instance will be discarded after cleanup; nested exception is: java.lang.Exception: Error occurred while preparing messages for Publication or while Publishing messages
    at com.bea.wli.mbconnector.rdbms.intrusive.RDBMSIntrusiveQryMDB.onMessage(RDBMSIntrusiveQryMDB.java:346)
    at weblogic.ejb20.internal.MDListener.execute(MDListener.java:400)
    at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:333)
    at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:298)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2698)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2523)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    >
    I have tried several things and had my team do research but we have not been able to find an answer to the problem.
    If anyone can offer any insight as to why we might be getting this error it would be greatly appreciated. Thanks!

    i also have same error during load testing, mainly this error
    "Unexpected exception while enlisting XAConnection java.sql.SQLException"
    i tried rerunning after increasing connection pool sizes, transaction timeout, but no luck, marginal improvement in performance though
    also tried changing the default tracking levl to none, but no luck.
    i am with 8.1SP5, how about you ?
    do share if you are able to bypass these errors
    cheers

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

  • Result set already closed

    Hi everyone,
    I know that there are already several threats on this issue, but none of them seems to sovle my issue.
    Hence, I'll try it again.
    JDeveloper: 11.1.1.3.0
    Action: Doing a delete of a row in an entity-based view object, doing a commit. Doing the exact same thing again, but now with an error : java.sql.SQLException: Result set already closed
    I'm unable to reproduce in a simple case.
    I tried to remove the commit statement, without success.
    I tried the following code:
          Map sessionMap;
          BindingContext context;
          String currentFrameName;
          DataControlFrame dcFrame;
          sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
          context = (BindingContext)sessionMap.get(BindingContext.CONTEXT_ID);
          currentFrameName = context.getCurrentDataControlFrame();
          dcFrame = context.findDataControlFrame(currentFrameName);
          dcFrame.commit();
          dcFrame.beginTransaction(null); Also without success.
    This is my original java code:
            OperationBinding deleteOper =
                ADFUtils.findOperation(OPERATION_DELETEINVOICE);
            deleteOper.execute();
            List errors = deleteOper.getErrors();
            if (errors != null && !errors.isEmpty()) {
                for (Object o : errors) {
                    logger.severe("Error during delete invoice : " + o + "-----" +
                                  o.getClass());
            //Committing the transaction
            OperationBinding commitOper = ADFUtils.findOperation(OPERATION_COMMIT);
            commitOper.execute();
            errors = commitOper.getErrors();
            if (errors != null && !errors.isEmpty()) {
                for (Object o : errors) {
                    logger.severe("Error during commit delete invoice : " + o +
                                  "-----" + o.getClass());
            }Does anyone have any idea's to tackle this problem?
    Thank you in advance.
    Filip Huysmans.
    <InvoiceFlowManagedBean><removeInvoice> Error during delete invoice : oracle.jbo.AttributeLoadException: JBO-27022: Kan waarde niet laden bij index 1 met Java-object van type java.lang.Integer vanwege java.sql.SQLException.-----class oracle.jbo.AttributeLoadException
    <Utils><buildFacesMessage> ADF: Adding the following JSF error message: Result set already closed
    java.sql.SQLException: Result set already closed
         at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:110)
         at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:65)
         at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getInt(Unknown Source)
         at oracle.jbo.common.IntegerTypeSQLNativeImpl.getDataFromResultSet(JboTypeMapEntries.java:506)
         at oracle.jbo.server.AttributeDefImpl.loadFromResultSet(AttributeDefImpl.java:2318)
         at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:3622)
         at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:2203)
         at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:5325)
         at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:5174)
         at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:3304)
         at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:3164)
         at oracle.jbo.server.QueryCollection.get(QueryCollection.java:2154)
         at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:4853)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2914)
         at oracle.jbo.server.ViewRowSetIteratorImpl.notifyRowDeleted(ViewRowSetIteratorImpl.java:3141)
         at oracle.jbo.server.ViewRowSetImpl.notifyRowDeleted(ViewRowSetImpl.java:1964)
         at oracle.jbo.server.ViewObjectImpl.notifyRowDeleted(ViewObjectImpl.java:10729)
         at oracle.jbo.server.ViewObjectImpl.notifyRowDeleted(ViewObjectImpl.java:10767)
         at oracle.jbo.server.QueryCollection.removeRow(QueryCollection.java:4038)
         at oracle.jbo.server.QueryCollection.afterRemove(QueryCollection.java:4003)
         at oracle.jbo.server.ViewObjectImpl.sourceChanged(ViewObjectImpl.java:12662)
         at oracle.jbo.server.EntityCache.sendEvent(EntityCache.java:1354)
         at oracle.jbo.server.EntityCache.deliverEntityEvent(EntityCache.java:1370)
         at oracle.jbo.server.EntityCache.notifyStateChange(EntityCache.java:1499)
         at oracle.jbo.server.EntityImpl.setState(EntityImpl.java:4895)
         at oracle.jbo.server.EntityImpl.remove(EntityImpl.java:8477)
         at oracle.jbo.server.ViewRowImpl.doRemove(ViewRowImpl.java:3196)
         at oracle.jbo.server.ViewRowImpl.remove(ViewRowImpl.java:3241)
         at oracle.jbo.server.QueryCollection.doRemove(QueryCollection.java:2425)
         at oracle.jbo.server.QueryCollection.remove(QueryCollection.java:2448)
         at oracle.jbo.server.ViewRowSetImpl.removeRowAt(ViewRowSetImpl.java:2396)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doRemoveCurrentRow(ViewRowSetIteratorImpl.java:2448)
         at oracle.jbo.server.ViewRowSetIteratorImpl.removeCurrentRow(ViewRowSetIteratorImpl.java:2473)
         at oracle.jbo.server.ViewRowSetImpl.removeCurrentRow(ViewRowSetImpl.java:3252)
         at oracle.jbo.server.ViewObjectImpl.removeCurrentRow(ViewObjectImpl.java:9965)
         at oracle.adf.model.binding.DCIteratorBinding.removeCurrentRow(DCIteratorBinding.java:2675)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1283)
         at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2141)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:730)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
         at be.fgov.health.mediflow.medicalcosts.view.bean.InvoiceFlowManagedBean.removeInvoice(InvoiceFlowManagedBean.java:957)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at be.fgov.health.mediflow.medicalcosts.view.util.JSFUtils.resolveMethodExpression(JSFUtils.java:96)
         at be.fgov.health.mediflow.medicalcosts.components.bean.RemoveConfirmationManagedBean.performRemove(RemoveConfirmationManagedBean.java:59)
         

    hi Filip
    Filip Huysmans wrote:
    ... Doing the exact same thing again, but now with an error : java.sql.SQLException: Result set already closed ...Maybe My Oracle Support note 1077305.1, "Random JBO-27122 and 'Closed Statement' Errors when Running ADF 11g App With XA Datasources", can help.
    Its "Solution" says
    "Don't use XA Datasources with ADF. So when creating a datasource in the WebLogic server make sure to change the Datasource JDBC driver from “Oracle’s Driver (Thin XA)” to “Oracle’s Driver (Thin)”. "
    success
    Jan Vervecken

  • How to get the result set in batches

    I have a query which results into large data. This data i want to display in a group of 20. After every 20 records i want to add header and footer to it.
    Is it possible to get the result set data into batch of 20 ? means can i specify start and end index of query ?
    regards
    Manisha

    What I am saying is that a big query with lots of
    joins will probably be slow, and as such would be a
    ripe candidate for batching the responses, if it were
    not possible to speed/optimize it. Batching is nice
    to look at for the user, but is not a solution for
    performance problems. In essence it is irrelevant
    that it adds a little performance deficit, as it
    appears to be running a lot quicker, and gives more
    feedback to the user.Then let me say it again....
    - "Join" is a term that applies to a method of doing queries in the database....
    - Query 1 which uses a join and returns 15 rows
    - Query 2 which does not use a join and returns 1500 rows.
    Given the above then Query 1 will provide better overall performance for the system than Query 2 in a properly configured database.
    If it doesn't then the database is not set up correctly.
    And again this will be irrespective of whether the query is scrollable or not.

  • Recursive delete cause error: result set already closed

    hi, will appreciate if someone can help me out on this. i need to delete the thread in a forum such that everytime administrator clicks to delete a thread, i need to recursively delete all the children too. however, when i have a thread with, say 2 children, only the 1st child can be deleted. i got this error msg: result set already closed. below is my codes. anyone can help? thks!
    public boolean deleteChat (long lngChatID) {
    strSQL = "delete from Chat_Tbl where Chat_Id = ? ";
    pst1 = con.prepareStatement(strSQL);
    pst1.setLong(1,lngChatID);
    intRowsUpdated = pst1.executeUpdate();
    strSQL = "select Chat_Id " +
    "from Chat_Tbl " +
    "where Parent_Id = ? ";
    pst1 = con.prepareStatement(strSQL);
    pst1.setLong(1,lngChatID);
    rs1 = pst1.executeQuery();
    while (rs1.next()) {
    lngNewChatID = rs1.getLong(1);
    deleteChat(lngNewChatID);
    }

    Hello
    strSQL = "delete from Chat_Tbl where Chat_Id = ? ";Can this statement be modified like this
    strSQL = "delete from Chat_Tbl where Parent_Id = ? ";
    HTH
    VJ

  • Saving the result set in a Search page

    Hi ,
    We have a manual search page where the results are displayed in the form of 10 columns. The first 5 are read only fields whereas rest 5 are editable checkboxes.
    There is no Query region created in our page.
    Suppose, fields a, b, c are search parameters and the results are as :
    | A | B | C| D |E | F | G | H | I | J |
    1
    2
    3
    4
    5
    6
    7
    7 records are retrieved. Columns A to E are read only text fields whereas columns F to J are check boxes. The user can update the checkboxes.  We have a Save button below the result set region. This button on being pressed invokes a stored PL/SQL Procedure which does some validations on the result set so obtained.
    Our requirement is to dump all the 7 records (after the modifications are made to any number of result records) into a temporary table . The procedure will then pick the records from this temporary table and do the required validations.
    Question is :
    1. How to store the result set so obtained into a table after some (or all) records are modified once Save is pressed ?
    We do not have any EO created in our page. The VO for obtaining the Result set is a combination of many tables.
    Any help would be greatly appreciated.
    Thanks,
    Neha

    River_Plate wrote:
    root cause
    java.lang.NullPointerException
    org.apache.jsp.tablasUF_jsp._jspService(tablasUF_jsp.java:68)Do you understand anyway when a NullPointerException would be thrown? Those kind of RuntimeExceptions are basic Java knowledge.
    If an object is null while you want to access it, then a NPE would be thrown. Check the line of the cause which objects could be null and fix it accordingly.

  • Why to need close the result set and statement

    why to need close the result set and statement

    It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
    These should be closed in a finally block.
    Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
    You can capture this in one nice utility class, like this:
    package db;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.LinkedHashMap;
    import java.util.List;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    * Created by IntelliJ IDEA.
    * User: MD87020
    * Date: Feb 16, 2005
    * Time: 8:42:19 PM
    * To change this template use File | Settings | File Templates.
    public class DatabaseUtils
         * Logger for DatabaseUtils
        private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
        /** Private default ctor to prevent subclassing and instantiation */
        private DatabaseUtils() {}
         * Close a connection
         * @param connection to close
        public static void close(Connection connection)
            try
                if ((connection != null) && !connection.isClosed())
                    connection.close();
            catch (SQLException e)
                logger.error("Could not close connection", e);
         * Close a statement
         * @param statement to close
        public static void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
            catch (SQLException e)
                logger.error("Could not close statement", e);
         * Close a result set
         * @param rs to close
        public static void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
            catch (SQLException e)
                logger.error("Could not close result set", e);
         * Close both a connection and statement
         * @param connection to close
         * @param statement to close
        public static void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static void close(Connection connection,
                                 Statement statement,
                                 ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
         * Helper method that maps a ResultSet into a map of columns
         * @param rs ResultSet
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs) throws SQLException
            List wantedColumnNames = getColumnNames(rs);
            return toMap(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a map of column lists
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs, List wantedColumnNames)
            throws SQLException
            // Set up the map of columns
            int numWantedColumns    = wantedColumnNames.size();
            Map columns             = new LinkedHashMap(numWantedColumns);
            for (int i = 0; i < numWantedColumns; ++i)
                List columnValues   = new ArrayList();
                columns.put(wantedColumnNames.get(i), columnValues);
            while (rs.next())
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value        = rs.getObject(columnName);
                    List columnValues   = (List)columns.get(columnName);
                    columnValues.add(value);
                    columns.put(columnName, columnValues);
            return columns;
         * Helper method that converts a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @return list of maps, one per row, with column name as the key
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs) throws SQLException
            List wantedColumnNames  = getColumnNames(rs);
            return toList(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return list of maps, one per column row, with column names as keys
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs, List wantedColumnNames)
            throws SQLException
            List rows = new ArrayList();
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Map row = new LinkedHashMap();
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.put(columnName, value);
                rows.add(row);
            return rows;
          * Return all column names as a list of strings
          * @param rs query result set
          * @return list of column name strings
          * @throws SQLException if the query fails
        public static final List getColumnNames(ResultSet rs) throws SQLException
            ResultSetMetaData meta  = rs.getMetaData();
            int numColumns = meta.getColumnCount();
            List columnNames = new ArrayList(numColumns);
            for (int i = 1; i <= numColumns; ++i)
                columnNames.add(meta.getColumnName(i));
            return columnNames;
    }Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
    Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
    scsi-boy is 100% correct.
    %

  • Result set is closed

    i am getting the messaeg "Result set is closed".
    anyone know what this is?

    Just a guess:
    A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.
    http://java.sun.com/j2se/1.4.1/docs/api/java/sql/ResultSet.html
    Post your code next time!

  • "java.sql.SQLException: Result set already closed"    on weblogic 9.1

    Hello together,
    i'm using hibernate 3.2.5ga on weblogic 9.1 through a data source with JTA defined to access oracle 10 with the Oracle's Thin XA Driver. Sporadically i get this:
    Caused by: java.sql.SQLException: Result set already closed
         at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:102)
         at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:58)
         at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getInt(Unknown Source)
         at org.hibernate.type.IntegerType.get(IntegerType.java:28)
         at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
         at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
         at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
         at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
         at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
         at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
         at org.hibernate.loader.Loader.getRow(Loader.java:1206)
         at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
         at org.hibernate.loader.Loader.doQuery(Loader.java:701)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
         at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    This exception is thrown when i try to execute a named query for retrieving some data.
    Does anybody know what is wrong?
    Edited by eazy_rida at 12/17/2007 8:32 AM

    Hi Joe
    Here is the full stack trace:
    org.springframework.orm.hibernate3.HibernateSystemException: Exception occurred inside setter of uk.co.cpp.ptarmigan.domain.npp.NppCoveredParty.assets; nested exception is org.hibernate.PropertyAccessException: Exception occurred inside setter of uk.co.cpp.ptarmigan.domain.npp.NppCoveredParty.assets
         at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
         at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
         at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:379)
         at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:872)
         at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:868)
         at uk.co.cpp.ptarmigan.business.dao.hibernate.HibernateNppPolicyDAOImpl.findPolicyByPolicyNumber(HibernateNppPolicyDAOImpl.java:109)
         at uk.co.cpp.testptarmigan.PartyServiceTest.testFetchPhoneAngelUser(PartyServiceTest.java:79)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
         at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    Caused by: org.hibernate.PropertyAccessException: Exception occurred inside setter of uk.co.cpp.ptarmigan.domain.npp.NppCoveredParty.assets
         at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65)
         at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
         at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
         at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3571)
         at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:133)
         at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
         at org.hibernate.loader.Loader.doQuery(Loader.java:729)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
         at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
         at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
         at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
         at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
         at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
         at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:844)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:241)
         at org.hibernate.loader.Loader.doList(Loader.java:2213)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:881)
         at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:374)
         ... 28 more
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
         ... 52 more
    Caused by: org.hibernate.exception.GenericJDBCException: could not initialize a collection: [uk.co.cpp.ptarmigan.domain.npp.NppCoveredParty.assets#component[partyId,policyId]{partyId=77951, policyId=78632}]
         at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         at org.hibernate.loader.Loader.loadCollection(Loader.java:2001)
         at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
         at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
         at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
         at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
         at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
         at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
         at org.hibernate.collection.PersistentBag.toArray(PersistentBag.java:257)
         at java.util.Collections.sort(Collections.java:158)
         at uk.co.cpp.ptarmigan.domain.npp.NppCoveredParty.setAssets(NppCoveredParty.java:54)
         ... 57 more
    Caused by: java.sql.SQLException: Result set already closed
         at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
         at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:137)
         at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_922_WLStub.next(Unknown Source)
         at weblogic.jdbc.rmi.internal.ResultSetStub_weblogic_jdbc_rmi_internal_ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_922_WLStub.next(Unknown Source)
         at weblogic.jdbc.rmi.internal.ResultSetStraightReader.next(ResultSetStraightReader.java:27)
         at weblogic.jdbc.rmi.SerialResultSet.next(SerialResultSet.java:84)
         at org.hibernate.loader.Loader.doQuery(Loader.java:697)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
         ... 66 more
    Caused by: java.sql.SQLException: Result set already closed
         at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:102)
         at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:58)
         at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
         at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
         at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.internalInvoke1(Unknown Source)
         at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:550)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:440)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:436)
         at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:58)
         at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:975)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    We are using using a connection within a client application (in our case we are executing this from a jUnit Integration test) so could this be caused by the handling of these remote connections?

  • How to exclude the XML declaration from each row of the result set?

    Hi,
    I have a table with an XMLTYPE column and would like to SELECT a set of rows. How can I exclude the XML declaration from each row in the result set? My query currently looks like this, I'm executing it through Spring JDBC:
    SELECT XMLSerialize(CONTENT t1.xmltext) FROM myschema.event t1 WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e") ORDER BY t1.time DESC
    After selecting, in my application I convert each row into a String and concatenate all rows into one big string in order to parse it into a DOM model. I get a parser exception (org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed) because there are multiple XML declarations in my big string. Of course, I could manually check the String of each row whether it starts with the XML declaration, but it would be nicer if I could instruct the DB not to add it in the first place. Is there a way?
    Thanks!
    -- Daniela

    Hi,
    A couple of options I can think of :
    SELECT XMLSerialize(CONTENT
    XMLtransform(t1.xmltext,
      xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes"/> 
    <xsl:template match="/"><xsl:copy-of select="*"/></xsl:template>
    </xsl:stylesheet>')
    FROM myschema.event t1
    WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
    ORDER BY t1.time DESC
    ;or simply,
    SELECT XMLSerialize(CONTENT
      extract(t1.xmltext,'/')
    FROM myschema.event t1
    WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
    ORDER BY t1.time DESC
    ;

  • Java.sql.SQLException: Result set already closed

    Hi,
    Our application is getting migrated to weblogic 10.3.5 and java 1.6.
    We use Ibatis(2.3.0.677.jar) in our application, when i am running my application, I get below exception in weblogic 10.3.5 with TransactionManager as JNDI.
    NOTE: This applicaiton runs very well in weblogic 9.2. And I have even tried locally using the JUnit with transactionManager as SIMPLE which works well too.
    BFSCITWA170546|CSI_APP_ID_NA|ERROR |0|2011-09-06 18:02:16,464|[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'|AbstractMessageConsumerMdb.java|:- [System] Failed processing message - rolling back
    com.citi.eztop.ezengine.refactoring.common.exception.MessageProcessingException: DAOException received
         at com.citi.eztop.ezengine.refactoring.workpublishing.mdb.WorkPublisherQueueConsumerMDB.handleTextMessage(WorkPublisherQueueConsumerMDB.java:87)
         at com.citi.eztop.ezengine.refactoring.common.mdb.AbstractMessageConsumerMdb.onMessage(AbstractMessageConsumerMdb.java:163)
         at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:574)
         at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
         at weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller.java:282)
         at weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:120)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: com.citi.eztop.ezengine.refactoring.common.exception.DAOException: Failed to queryForObject [WorkItem.getWorkItemById]
         at com.citi.eztop.ezengine.refactoring.common.persistence.sqlmapdao.BaseSqlMapDao.queryForObject(BaseSqlMapDao.java:60)
         at com.citi.eztop.ezengine.refactoring.common.persistence.sqlmapdao.WorkItemSqlMapDao.getWorkItemById(WorkItemSqlMapDao.java:15)
         at com.citi.eztop.ezengine.refactoring.workpublishing.businesslayer.WorkPublisher.process(WorkPublisher.java:73)
         at com.citi.eztop.ezengine.refactoring.workpublishing.mdb.WorkPublisherQueueConsumerMDB.handleTextMessage(WorkPublisherQueueConsumerMDB.java:83)
         ... 8 more
    Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
    --- The error occurred in com/citi/eztop/ezengine/refactoring/common/persistence/sqlmapdao/sql/WorkItem.xml.
    --- The error occurred while applying a result map.
    --- Check the WorkItem.workItemResultMap.
    --- The error happened while setting a property on the result object.
    --- Cause: java.sql.SQLException: Result set already closed
         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:541)
         at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
         at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:83)
         at com.citi.eztop.ezengine.refactoring.common.persistence.sqlmapdao.BaseSqlMapDao.queryForObject(BaseSqlMapDao.java:56)
         ... 11 more
    Caused by: java.sql.SQLException: Result set already closed
         at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:144)
         at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:97)
         at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
         at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
         at $Proxy78.next(Unknown Source)
         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:380)
         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190)
         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
         ... 17 more
    Please help me to resolve this issue, as I am stuck with this.

    Hi Joe,
    Thanks alot for your reply, but the same code is working in weblogic 9.2 and it is in production as well.
    I have even replicated the settings of 9.2 to 10.3, but still was not able to fnd out the issue.
    Anyways will file an SR and provide it for you.
    Thanks,
    Addhankkiv

  • How to send email using pl/sql containing the result set as the msg body

    Hi.. im using Pl/SQL code to send emails to the users from a dataset that is obtained in a databse table. i have used utl_smtp commands to establish the connection with the smtp mail server. im stuck at the logic when i have to include the message body which is actually the result set of a table.. For instance
    IF (p_message = 0) THEN
    UTL_SMTP.write_data(l_mail_conn, 'There is no mismatch between the codes' || UTL_TCP.crlf);
    ELSE
    UTL_SMTP.write_data(l_mail_conn, 'The missing codes are ' || UTL_TCP.crlf);
    for s in (select * from temp)
    loop
    UTL_SMTP.write_data(l_mail_conn, ' ' ||s || UTL_TCP.crlf);
    end loop;
    END IF;
    UTL_SMTP.close_data(l_mail_conn);
    UTL_SMTP.quit(l_mail_conn);
    END;
    ***p_message is a prameter passed to this procedure..
    Can i obtain the result in the form i have it in my table. which has three columns. I want to display the three columns as it is with teh records. ?

    this is not related about this forum but you can use below,
    CREATE OR REPLACE PROCEDURE SEND_MAIL (subject varchar2,mail_from varchar2, mail_to varchar2,mail_msg varchar2)
    IS
    mail_host varchar2(30):='XXXXX';
    mail_conn utl_smtp.connection;
    tz_offset number:=0;
    str varchar2(32000);
    BEGIN
    begin
    select to_number(replace(dbtimezone,':00'))/24 into tz_offset from dual;
    exception
    when others then
    null;
    end;
    mail_conn:=utl_smtp.open_connection(mail_host, 25);
    utl_smtp.helo(mail_conn,mail_host);
    utl_smtp.mail(mail_conn,'[email protected]');
    utl_smtp.rcpt(mail_conn,mail_to);
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn,'Date: '||to_char(sysdate-tz_offset,'dd mon yy hh24:mi:ss')||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'From: '|| mail_from ||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'To: "'|| mail_to ||'" <'||mail_to||'>'||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'Subject: '||subject||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,replace_turkish_chars(mail_msg)||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    Edited by: odilibrary.com on Jun 12, 2012 5:26 PM

  • How to add a dummy row in the result set of a SELECT statement.

    Hello Everyone -
    I have requirment to add a dummy row in the result set of a SELECT statement.
    For e.g. lets say there is a table Payment having following colums:
    Payment_id number
    status varchar2(10)
    amount number
    payment_date date
    so here is the data :-
    Payment_id Status Amount payment_date
    1 Applied 100 12/07/2008
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    Here is my SQL
    Select * form payment where payment_date >= 01/01/2009
    Output will be
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    My desired output is below
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    2 Reversed -200 01/ 06/2009 ------(Dummy Row)
    Thrid row here is the dummy row which I want to add when status is "Reversed"
    I would be very thankful for any kind of help in this regard ...
    Thanks,
    Gaurav

    Cartesion joining against a dummy table is a useful method of creating a dummy row:
    with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
                    --- end of mimicking your table
          dummy as (select 'Reversed' col1, 1 rn from dual union all
                    select 'Reversed' col1, 2 rn from dual)
    select mt.cust_id,
           mt.payment_id,
           mt.status,
           decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
           mt.payment_date
    from   my_tab mt,
           dummy
    where  mt.status = dummy.col1 (+)
    order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
    CUST_ID     PAYMENT_ID     STATUS     AMOUNT     PAYMENT_DATE
    1     1     Applied     100     07/12/2008
    1     2     Reversed     200     06/01/2009
    1     2     Reversed     -200     06/01/2009
    1     3     Applied     300     06/01/2009
    2     1     Applied     100     07/12/2008
    2     2     Reversed     200     05/01/2009
    2     2     Reversed     -200     05/01/2009
    2     3     Applied     300     06/01/2009
    2     4     Reversed     -400     06/01/2009
    2     4     Reversed     400     06/01/2009
    2     5     Applied     500     07/01/2009Edited by: Boneist on 07-Jan-2009 23:10
    NB. You may have to mess around with the ordering if that's not come back in the order you wanted. You didn't mention what the rules were for any expected ordering though, so I've made up my own *{;-)
    Also, I added an identifier (cust_id) to differentiate between different sets of payments, since that's usually the case. Remove that if it's not applicable for your case.

Maybe you are looking for