Stream has already been closed - in SQL Developer v4.0.0.12

Within SQL Developer v4.0.0.12 (Build 12.84) I have "Stream has already been closed" error message in the "Query result" pane.
Used SQL:
     select * from all_mviews;
Oracle11g Database v11.2.0.3 but this query works fine within SQL*Plus.
When I select all the columns, I have the same error:
     select OWNER, MVIEW_NAME, CONTAINER_NAME, QUERY, QUERY_LEN, UPDATABLE, UPDATE_LOG, MASTER_ROLLBACK_SEG,
            MASTER_LINK, REWRITE_ENABLED, REWRITE_CAPABILITY, REFRESH_MODE, REFRESH_METHOD, BUILD_MODE,
            FAST_REFRESHABLE, LAST_REFRESH_TYPE, LAST_REFRESH_DATE, STALENESS, AFTER_FAST_REFRESH, UNKNOWN_PREBUILT,
            UNKNOWN_PLSQL_FUNC, UNKNOWN_EXTERNAL_TABLE, UNKNOWN_CONSIDER_FRESH, UNKNOWN_IMPORT, UNKNOWN_TRUSTED_FD,
            COMPILE_STATE, USE_NO_INDEX, STALE_SINCE, NUM_PCT_TABLES, NUM_FRESH_PCT_REGIONS, NUM_STALE_PCT_REGIONS
       from all_mviews;
I though it was the QUERY column (datatype is LONG), but the following SQL works fine:
     select OWNER, MVIEW_NAME, CONTAINER_NAME, QUERY, query_len, updatable, update_log, master_rollback_seg,
            master_link, rewrite_enabled, REWRITE_CAPABILITY, REFRESH_MODE, REFRESH_METHOD, BUILD_MODE,
            FAST_REFRESHABLE, LAST_REFRESH_TYPE, LAST_REFRESH_DATE, STALENESS, AFTER_FAST_REFRESH, UNKNOWN_PREBUILT,
            UNKNOWN_PLSQL_FUNC, UNKNOWN_EXTERNAL_TABLE, UNKNOWN_CONSIDER_FRESH, UNKNOWN_IMPORT, UNKNOWN_TRUSTED_FD,
            COMPILE_STATE, USE_NO_INDEX, STALE_SINCE, NUM_PCT_TABLES
       from all_mviews;
just left out some columns (at the end).
This works also, all columns but just leaving out the QUERY column:
     select OWNER, MVIEW_NAME, CONTAINER_NAME, QUERY_LEN, UPDATABLE, UPDATE_LOG, MASTER_ROLLBACK_SEG, MASTER_LINK,
            REWRITE_ENABLED, REWRITE_CAPABILITY, REFRESH_MODE, REFRESH_METHOD, BUILD_MODE, FAST_REFRESHABLE,
            LAST_REFRESH_TYPE, LAST_REFRESH_DATE, STALENESS, AFTER_FAST_REFRESH, UNKNOWN_PREBUILT, UNKNOWN_PLSQL_FUNC,
            UNKNOWN_EXTERNAL_TABLE, UNKNOWN_CONSIDER_FRESH, UNKNOWN_IMPORT, UNKNOWN_TRUSTED_FD, COMPILE_STATE,
            USE_NO_INDEX, STALE_SINCE, NUM_PCT_TABLES, NUM_FRESH_PCT_REGIONS, NUM_STALE_PCT_REGIONS
       from all_mviews;
It seams that these queries are reaching the limit (of data transfer) within SQL Developer v4.0.0.12 (note this was also a problem in SQL Developer v3.x).

Hi Guy,
Did you happen to see this recent discussion?  SQL Developer v4 giving error 'Stream has been closed' while querying tables containing long data
I recommend trying the workaround described there just in case your issue also relates to LONG column:
Add the following line in sqldeveloper.conf file:
   AddVMOption -Doracle.jdbc.useFetchSizeWithLongColumn=true
Regards,
Gary
SQL Developer Team

Similar Messages

  • 'Connection has already been closed'. Random error connecting with a pool

    Hi all,
    I've got a problem I cannot solve, and really hope in someone's help...
    The fact is: I'm working on a webapp which doesn't made use of frameworks or patterns or similars. I introduced the DAO pattern in order to organize and speed up the work. At the core of the new classes there is the DBDAO, and this is the way it obtains the connection:
          protected Connection conn = null;           ...             protected Connection getConnection()       {           try           {             if (conn == null || conn.isClosed())             {                     Context ctx = new InitialContext();                 javax.sql.DataSource ds=null;                     ds =(javax.sql.DataSource) ctx.lookup( "agespPool" );                     conn = ds.getConnection();                 conn.setAutoCommit(false);             }           }           catch (Exception ne)     ...
    Every new class that needs to access the db extends DBDAO and retrieves the conn with this method. In order to make things work without changing all the code, I modified the old class named 'Connessione' and made it extend DBDAO. Here is its method:
        public class Connessione extends DBDAO{     ...             public static synchronized Connection getConnessione() throws Exception {             return new Connessione().getConnection();         }
    That's all. Finished with the code.
    Now, if someone uses the new classes extending DBDAO, all goes well. But for some old function that still work with Connessione.getConnessione(), connection closes suddenly with no reason.
    For example, calling a page with some combo box populated with a db connection, you catch a:
        java.sql.SQLException: Connection has already been closed.             at weblogic.jdbc.wrapper.PoolConnection.checkConnection(PoolConnection.java:63)             at weblogic.jdbc.wrapper.ResultSetMetaData.preInvocationHandler(ResultSetMetaData.java:37)             at weblogic.jdbc.wrapper.ResultSetMetaData_oracle_jdbc_driver_OracleResultSetMetaData.getColumnType(Unknown Source)             at it.praxis.tim.agesp.pub.sql.PagingList.populate(PagingList.java:98)             at it.praxis.tim.agesp.pub.sql.PagingList.executeSQL(PagingList.java:53)             at jsp_servlet._jsp._todolist_new._richiesta.__listarichieste._jspService(__listarichieste.java:353)             at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    or sometimes:
        - 20080417141147: <E> HtmlSelect.createHtmlSelect(4) - Errore!     java.sql.SQLException: Result set already closed     - 20080417141147: <E> HtmlSelect.createHtmlSelect(7) - Errore!     java.sql.SQLException: Connection has already been closed.     - 20080417141147: <E> ERRORE:  ricercaRichieste :     java.sql.SQLException: Statement has already been closed
    That is, the conn is closed while used to populate the combo box. I don't understand who closes it.
    Moreover, that happens randomly: 1 or 2 times over 4 hits on the page. The other times, all goes well. Most of the other pages, all goes well. So I don't think I have to search for a bug in the code.
    Now, I'm working with BEA WL 8.1 sp 5 and Oracle 9.2.0.1.0 .
    The error turns out even if I work locally (with Tomcat 5.5.23).
    The webapp made use of a custom driver beforehand, and I replaced it with oracle's driver.
    I tried to set the Connection Pool with oracle.jdbc.driver.OracleDriver and oracle.jdbc.OracleDriver .
    I left the default for the connection pool, and then tried to set (BEA):
    Connection Reserve Timeout: -1
    Test Created Connections: On
    with no changes.
    The connection suddenly and randomly closes.
    Any help would be appreciated...
    Many thanks

    the thing that you are instantiating isn't a Connection object, it's a Connessione object. That's returning one that's either been stashed from a previous call, or
    acquires one from the data sourcea new Connessione object means a call to getConnection that means a new Connection object. That code is synchronized, it has to be a new object.
    It is entirely possible that conn is not null if other actions have taken place in your constructor. Even assuming it is null, we don't know anything about the
    connection pool you're trying to use, though it looks like it's probably weblogic's one.The contructor doesn't know of the connection. As for the pool, it is weblogic's one.
    And even assuming both of these cases, we have no particular reason to believe that you're calling the getConnessione() method instead of accidentally calling
    getConnection() and thus no reason to believe that you're definitely carrying out the actions that you believe you're carrying out.I wrote that the problem comes out in the old code that once worked fine. That code only uses Connessione.getConnessione() .
    Conversely we have an error message that says you're closing connections elsewhere. Clearly there's a bug. It's presumably in your assumptions. You're
    arguing instead of checking them.If I have a wrapper logging the close() calls, I have to see every call logged. Even if there's a bug (but remember that the code worked fine with a previous custom datasource), why do you think I shouldn't see that close() logged?
    I may be wrong, but I already searched in that code. I'm arguing after all the checks.
    There is no other thread that can see that connHow do you know? I have that Connessione.getConnessione() in a jsp. It's synchronized. That gives a new connection. I see it passed only to an utility class that queries the db and reads the resultset.
    Who do you think can access that connection?

  • Connection has already been closed

    We are on Weblogic 7.0 SP1 on HP UX 11i. Database is Oracle ver 9.0.1.3. Using
    thin driver for database access.
    Intermittently we get the error: "Connection has already been closed" from DAO
    programs. The stack trace shows that this error is preceded by java.sql.SQLException:
    java.lang.NullPointerException. The error is appearing in the finally block when
    we attempt to close the connection if it is not null. Here's the code piece:
    finally {
    try {
    if(connection != null)
    connection.close();
    connection = null;
    } catch (SQLException sqlException) {
    log4j.error(sqlException.toString());
    What we are not able to understand is, this piece of code can be executed only
    if connection object is not null and if so, why this error - 'Connection has already
    been closed'?
    We noticed a bug reported in SP1:
    Bug No: CR062827
    Description : Fixed a problem with prepared statement code that was provoking
    a null pointer exception; the prepared statement object was being set to null.
    Our error message is preceded by Nullpointer Exception and there is a possibility
    that it could be from PreparedStatement due to this bug. But, BEA has not given
    information on what happens to Connection when Prepared Statement throw this exception.
    Whether any of you facing the same kind of problem?
    Thanks in advance,

    chitra wrote:
    Here's the stack trace:
    2003-01-24 10:24:32,510 ERROR [ExecuteThread: '5' for queue: 'default'] (TestDao.java:203)
    - java.sql.SQLException: java.lang.NullPointerException
    2003-01-24 10:24:32,511 ERROR [ExecuteThread: '5' for queue: 'default'] (TestDao.java:228)
    - java.sql.SQLException: Connection has already been closed.
    Sometimes, we also get a different stack trace:
    2003-01-24 10:24:21,171 ERROR [ExecuteThread: '5' for queue: 'default'] (TestDao.java:203)
    - java.sql.SQLException: Closed Statement: next
    2003-01-24 10:24:21,180 ERROR [ExecuteThread: '5' for queue: 'default'] (TestDao.java:228)
    - java.sql.SQLException: Connection has alredy been closed
    ThanksHi, that's not a stacktrace. That's just the error message. Please turn on jdbc logging and show me
    the jdbc log
    file. A full stacktrace will pe printed for every SQLException, showing all the method calls.
    thanks,
    Joe
    >
    >
    Joseph Weinstein <[email protected]> wrote:
    chitra wrote:
    We are on Weblogic 7.0 SP1 on HP UX 11i. Database is Oracle ver 9.0.1.3.Using
    thin driver for database access.
    Intermittently we get the error: "Connection has already been closed"from DAO
    programs. The stack trace shows that this error is preceded by java.sql.SQLException:
    java.lang.NullPointerException. The error is appearing in the finallyblock when
    we attempt to close the connection if it is not null. Here's the codepiece:
    finally {
    try {
    if(connection != null)
    connection.close();
    connection = null;
    } catch (SQLException sqlException) {
    log4j.error(sqlException.toString());
    What we are not able to understand is, this piece of code can be executedonly
    if connection object is not null and if so, why this error - 'Connectionhas already
    been closed'?Let me see the full stacktrace of the NullPointerException and the
    'Connection is already closed' exception.
    As to the code above, I'm not saying you're doing this, but if any code
    above that finally block closed the connection, then you can get the
    'already closed' exception. In other words, connection.close() doesn't
    automatically make the reference null.
    Joe
    We noticed a bug reported in SP1:
    Bug No: CR062827
    Description : Fixed a problem with prepared statement code that wasprovoking
    a null pointer exception; the prepared statement object was being setto null.
    Our error message is preceded by Nullpointer Exception and there isa possibility
    that it could be from PreparedStatement due to this bug. But, BEAhas not given
    information on what happens to Connection when Prepared Statement throwthis exception.
    Whether any of you facing the same kind of problem?
    Thanks in advance,

  • Connection handle of this Interaction has already been closed

    Dear All,
    We are facing problem in Portal application and the portal screen shows
    "WARNING : DOMG:0001 : EN: Applicatie Foutcould not create JCOClientconnection for logical system: WD_MODELDATA_DEST - Model..." When i checked the JCO and it seems to be working fine.
    This error message occurs not all the time but it happens very often nowdays in our production system.
    The trace file has the below info ....
    #1.5 #005056917DFC0065000001700000148000048ACD4C7672EF#1278514262577
    #com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModel#sap.com/tcwddispwda#
    com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModel.JcoClientManagementWDP#m.
    vanginhoven#10799##n/a##0fee4bb889d711dfa9cc005056917dfc#SAPEngine_Application
    Thread[impl:3]74ID\#(J2EE3880500)ID0960469550DB02703921047067447299End.
    WID1278484862289##0#0#Error##Plain###Could not create JCOClientConnection for
    logical System: *'WD_MODELDATA_DEST' *- Model: 'class com.nl.cv.pr.productlijst.
    Zorg_Arrangementproduct_Lijst_Model'. #
    #1.5 #005056917DFC002A000009B40000148000048ACD4F560780#1278514310781
    #System.err#phobos/phobos~dcrlcear#System.err#Guest#0##as-careview1_EPP_3880550##2a53432b89d711dfbb8a005056917dfc#SAPEngine_
    Application_Thread[impl:3]_38##0#0#Error##Plain###Connection handle of this
    Interaction has already been closed#
    #1.5 #005056917DFC002A000009B50000148000048ACD4F560987#1278514310781
    #System.err#phobos/phobos~dcrlcear#System.err#Guest#0##as-careview1_EPP_3880550##2a53432b89d711dfbb8a005056917dfc#SAPEngine_
    Application_Thread[impl:3]_38##0#0#Error##Plain###Connection is already closed
    and no longer associated with a managed connection#
    Do anyone have any idea on this issue? Please help me out to fix this problem
    Regards
    Raj

    Hi,
    The error message "Could not create JCOClientConnection for logical System" is only triggered when the WebDynpro application is requesting more JCO connections than the number of JCOs allocated for this application.                                                                               
    I suggest to carefully go through the documents below in order to properly configure your JCOs. If necessary, remove them and recreate in the correct way:                                                                               
    JCo Quick Summary                                                         
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/85a483cb-0d01-0010-2990-c5168f01ce8a                                                                               
    How to Configure the JCo Destination Settings                             
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3103eb90-0201-0010-71af-be6f4a6f61d1                                                                               
    You will have to calculate the maximum number of JCo connections to each application based on Models and users.
    Br,
    Javier

  • 9006Connection has already been closed

    I am using WL server 6.1 SP2 with Apache plugin. I am continuously getting the
    following message in my app server log
    9006Connection has already been closed.
    Any ideas what is causing this message?
    Thanks

    Hi,
    Problem might be that your statement times out or your connection is getting closed when the statement executes.
    --Sushant                                                                                                                                                                                                                                                                       

  • Error Message: "One of the base documents has already been closed".

    Hello everyone
    I would appreciate very much if someone can help me.  The following error message prompts up when trying to create a Credit Note BASED on a A/R Invoice: "One of the base documents has already been closed". it is necesssary to say that we are not changing anything in between the two documents.
    We are running SAP Business One 2007A PL49.
    Thanks very much
    Claudia

    Hi.
    Please read this SAP Note: [854781 Error message "Invoice is already closed or blocked".|https://websmp230.sap-ag.de/sap(bD1lcyZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=S&note_numm=0001290054|Click here to view].
    This issue could be related to decimal places in amounts.
    This could be caussed by changing the decimal places for amounts, prices, etc. in General Settings.
    Regards.

  • Error: One of the base documents has already been closed (-10)

    I have a web service to get and set pick lists and add delivery notes via DI Server. but I have one scenario that causes the error 'Error: One of the base documents has already been closed (-10)':
    i have a pick list with item A1 with a quantity of 10. I pick and delivery 3. now the pick list is closed and in the picklist creation dialog I can choose the remaining 7 of A1 for another picklist. but if I do so and then try to pick and delivery the remaining 7, I'm getting that error. The sales order, that is the base document of the pick list and the delivery, is still 'open'. so, what base document is meant here?

    I found the error. I tried to add the DocumentsAdditionalExpenses to the second delivery, too, and this is not possible.

  • ITunes won't open if it has already been closed in the same session. No error message appears and I have already unistalled/reinstalled iTunes with no result.

    My iTunes opens fine if it is the first time I have opened it since turning my computer on. If I close iTunes, however, it won't open again unless I restart my computer. No error message appears. Clicking on both the shortcut and file in iTunes folder does nothing. I unistalled iTunes and reinstalled it but the issue hasn't gone away. A virus scan has come up with nothing. I would appreciate any ideas that might help to fix this issue.

    Having the same problem - am running Win 7 Pro 32 bit. Discovered that when you close iTunes task manager shows that iTunes.exe is still running and will not close unless you reboot. I have also found that after starting Win 7 that if I launch iTunes by inserting a CD, the CD plays and displays all tracks correctly. However, if I eject the CD and insert a different one neither Win 7 or iTunes recognises the CD. These problems seem to have started with the release of 10.5.2 - prior to that no problems at all. Have tried reinstalling and it does not make any difference.

  • Generate Scripts in SQL Server 2008 R2 producing Error "Item has already been added.:

    I am trying to run a Generate Scripts Task on a Database to generate a script for every object in the DB including tables, SPs, UDFs, FKs, PKs, with the settings for Schema Only, Script Drop and Create, Script "if not Exists", use database,
    and Object level permissions. 
    I have used generate scripts before to generate this database about 5 months ago and every thing worked fine. 
    Today I first tried to generate it out on a server where I only have "db_Owner" for several databases.  This failed with the error.
    Microsoft.SqlServer.Management.Smo.FailedOperationException: Discover dependencies failed. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name='VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']' Key being added: 'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name='VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']' at System.Collections.SortedList.Add(Object key, Object value) at Microsoft.SqlServer.Management.Smo.DependencyTree..ctor(Urn[] urns, DependencyChainCollection dependencies, Boolean fParents, Server server)
    So I tried tto do this on a local version of the database where I have sa rights.  Same error.
    Can someone advise me on what is going on here and how do I fix it?
    Edward R. Joell MCSD MCDBA

    How do you generate the script via SMO?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL Server reporting services error "URl has already been reserved" while doing upgrade from SQL server 2008 R2 to SQL server 2012

    "URl has already been reserved".
    Reporting services for port 80 and 443 works fine both for reports and reportingserver on SQL server 2008 R2. But when I try to upgrade from SQL server 2008 R2 to 2012 this error pops up. How to make sure before upgrading regarding reporting services that
    URL reserves and SSL are fine  or how to fix reporting services are upgrade like repair install.
    Thanks

    Hi yashmitl,
    In your case, please running the following command to check the current URL reservations on http.sys.
    netsh http show urlacl
    Then, please delete the URL reservation by executing the following command try to resolve the issue.
    netsh http delete urlacl <url>
    There is a similar issue, you can refer to it.
    http://social.technet.microsoft.com/Forums/en-US/d5204dd3-e26d-4592-8ef0-a94005fc46a5/the-url-has-already-been-reserved?forum=sqlreportingservices
    Hope this helps.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Java.sql.SQLException: Connection has already been created in this tx context for pool named adrxSYBDEV07

    I keep getting the following error when I try to use 2 different java.sql.Connections
    from 2 different database connection pools in my message ejb. The message ejb
    uses container managed transaction. The 2 connection pools point to different
    Sybase Servers.
    Any help will be much appreciated !!!
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named adrxSYBDEV07. Illegal attempt to create connection from another
    pool: Sybbev07Pool JDBCUtil > getConnection()

    Hi Eddie,
    "Eddie Baue" <[email protected]> wrote in message
    news:3ddbf74f$[email protected]..
    I keep getting the following error when I try to use 2 differentjava.sql.Connections
    from 2 different database connection pools in my message ejb. The messageejb
    uses container managed transaction. The 2 connection pools point todifferent
    Sybase Servers.In order to access more then one database base within
    a TX you need to have TXDataSources backed by XA
    connection pools...
    Regards,
    Slava Imeshev

  • IllegalStateException: getOutputStream() has already been called

    Hi guys,
    I am writing JSP to retrieve data from database and export to the user as csv or zip file. It has to be binary. I would like to a download dialog to show up and allow users to choose where to save the exported file.
    Funcitonally, it works fine althrough I get an error page saying nothing to display. But it always complains that IllegalStateException: getOutputStream() has already been called for this session. I have done much research and testing, but....in vain.
    Hope somebody could help me with this. so frustrated that I am about to explode.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="application/octet-stream">
            <title>Load Page</title>
        </head>
        <body >
            <% OutputStream outRes = response.getOutputStream( ); %><%@page contentType="application/octet-stream"%><%
            %><%@page pageEncoding="UTF-8" import="java.sql.*,java.io.*,java.util.*,java.util.zip.*,java.math.BigDecimal;"%><%
            %><%
            try {
                Class.forName(ResourceBundle.getBundle("map").getString("driver"));
            } catch (ClassNotFoundException ex) {
               //ex.printStackTrace();
               return;
            String EXPORT_DIR = ResourceBundle.getBundle("map").getString("SUBMITTAL_EXPORT_DIR");
            String EXPORT_NAME = ResourceBundle.getBundle("map").getString("SUBMITTAL_NAME");
            String EXPORT_ZIP_NAME = ResourceBundle.getBundle("map").getString("SUBMITTAL_ZIP_NAME"); 
            String sqlQuery = "SELECT EMP_ID, EMP_NAME FROM EMP";
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            OutputStream expStream = null;
            boolean success = false;
            try {
                //out.println("<p>Connecting to the source database ...");
                // establish database connection
                conn = DriverManager.getConnection(
                        ResourceBundle.getBundle("map").getString("sqlurl"),
                        ResourceBundle.getBundle("map").getString("ORACLE_DBUSER"),
                        ResourceBundle.getBundle("map").getString("ORACLE_DBPASSWORD") );
                stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
                rs = stmt.executeQuery(sqlQuery);
                //out.println("Done</p>");
                // open a file to write
                File exportFile = new File(EXPORT_DIR + File.separatorChar + EXPORT_NAME);
                if (exportFile.exists())  exportFile.delete();
                exportFile.createNewFile();
                expStream = new BufferedOutputStream(new FileOutputStream(exportFile));
                // iterate all records to save them to the file
                //out.print("<p>Exporting the table data ...");
                while(rs.next()) {
                    String recordString = "";
                    ResultSetMetaData metaData = rs.getMetaData() ;
                    int colCount = metaData.getColumnCount();
                    for(int i=1; i<=colCount; i++) {
                        int colType = metaData.getColumnType(i);
                        switch(colType) {
                            case Types.CHAR: {
                                String sValue = rs.getString(i);
                                if (rs.wasNull())
                                    recordString += ("'',");
                                else
                                    recordString += ("'"+ sValue + "',");
                                break;
                            case Types.VARCHAR: {
                                String sValue = rs.getString(i);
                                if (rs.wasNull())
                                    recordString += ("'',");
                                else
                                    recordString += ("'"+ sValue + "',");
                                break;
                            case Types.FLOAT: {
                                float fValue = rs.getFloat(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (fValue + ",");
                                break;
                            case Types.DOUBLE: {
                                double dbValue = rs.getDouble(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (dbValue + ",");
                                break;
                            case Types.INTEGER: {
                                int iValue = rs.getInt(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (iValue + ",");
                                break;
                            case Types.NUMERIC: {
                                BigDecimal bdValue = rs.getBigDecimal(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (bdValue + ",");
                                break;
                            default:
                                out.println("<p><font color=#ff0000> Unidentified Column Type "
                                        + metaData.getColumnTypeName(i) + "</font></p>"); */
                                success = false;
                                return;
                    recordString = recordString.substring(0, recordString.length()-1);
                    expStream.write(recordString.getBytes());
                    expStream.write((new String("\n")).getBytes());
                expStream.flush();
                //out.println("Done</p>");
                //out.println("<p>Data have been exported to " + filepath + "</p>");
                success = true;
            } catch (SQLException ex) {
               //out.println(ex.getStackTrace());
            } catch (IOException ex) {
               //out.println(ex.getStackTrace());
            } finally {
                if (expStream != null) {
                    try {
                        expStream.close();
                    } catch (IOException ex) {
                       // out.println(ex.getStackTrace());
                if (rs != null) {
                    try {
                        rs.close();
                    } catch(SQLException ex) {
                        //out.println(ex.getStackTrace());
                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch(SQLException ex) {
                       // out.println(ex.getStackTrace());
                if(conn != null) {
                    try {
                        conn.close();
                    } catch(SQLException ex) {
                       // out.println(ex.getStackTrace());
            if (!success) return;
             * compress the exported CSV file if necessary
            int DATA_BLOCK_SIZE = 1024;
            if (request.getParameter("zip")!=null && request.getParameter("zip").equalsIgnoreCase("true")) {
                success = false;
                BufferedInputStream sourceStream = null;
                ZipOutputStream targetStream = null;
                try {
                    File zipFile = new File(EXPORT_DIR + File.separatorChar + EXPORT_ZIP_NAME);
                    if (zipFile.exists())  zipFile.delete();
                    zipFile.createNewFile();
                    FileOutputStream fos = new FileOutputStream ( zipFile );
                    targetStream = new ZipOutputStream ( fos );
                    targetStream.setMethod ( ZipOutputStream.DEFLATED );
                    targetStream.setLevel ( 9 );
                     * Now that the target zip output stream is created, open the source data file.
                    FileInputStream fis = new FileInputStream ( EXPORT_DIR + File.separatorChar + EXPORT_NAME );
                    sourceStream = new BufferedInputStream ( fis );
                    /* Need to create a zip entry for each data file that is read. */
                    ZipEntry theEntry = new ZipEntry ( EXPORT_DIR + File.separatorChar + EXPORT_NAME );
                     * Before writing information to the zip output stream, put the zip entry object
                    targetStream.putNextEntry ( theEntry );
                    /* Add comment to zip archive. */
                    //targetStream.setComment( "comment" );
                    /* Read the source file and write the data. */
                    byte[] buf = new byte[DATA_BLOCK_SIZE];
                    int len;
                    while ( ( len = sourceStream.read ( buf, 0, DATA_BLOCK_SIZE ) ) >= 0 ) {
                        targetStream.write ( buf, 0, len );
                     * The ZipEntry object is updated with the compressed file size,
                     * uncompressed file size and other file related information when closed.
                    targetStream.closeEntry ();
                    targetStream.flush ();
                    success = true;
                } catch ( FileNotFoundException e ) {
                    //e.printStackTrace ();
                } catch ( IOException e ) {
                    //e.printStackTrace ();
                } finally {
                    try {
                        if (sourceStream != null)
                            sourceStream.close ();
                        if (targetStream != null)
                            targetStream.close ();
                    } catch(IOException ex) {
                        //ex.printStackTrace();
                if (!success) return;
             * prompt the user to download the file
            //response.setContentType("text/plain");
            //response.setContentType( "application/octet-stream" );
            InputStream inStream = null;
            //OutputStream outRes = null;
            try {
                if (request.getParameter("zip")!=null && request.getParameter("zip").equalsIgnoreCase("true")) {
                    response.setHeader("Content-Disposition", "attachment;filename=" + EXPORT_ZIP_NAME);
                    inStream = new BufferedInputStream(new FileInputStream(EXPORT_DIR + File.separatorChar + EXPORT_ZIP_NAME));
                else {
                    response.setHeader("Content-Disposition", "attachment;filename=" + EXPORT_NAME);
                    inStream = new BufferedInputStream(new FileInputStream(EXPORT_DIR + File.separatorChar + EXPORT_NAME));
                out.clearBuffer();
                //outRes = response.getOutputStream(  );
                byte[] buf = new byte[4 * DATA_BLOCK_SIZE];  // 4K buffer
                int bytesRead;
                while ((bytesRead = inStream.read(buf)) != -1) {
                    outRes.write(buf, 0, bytesRead);
                outRes.flush();
                int byteBuf;
                while ( (byteBuf = inStream.read()) != -1 ) {
                    out.write(byteBuf);
                out.flush();
            } catch (IOException ex) {
                //ex.printStackTrace();
            finally {
                try {
                    if (inStream != null)
                        inStream.close();
                    if (outRes != null)
                        outRes.close();
                } catch(IOException ex) {
                    //ex.printStackTrace();
          %>
        </body>
    </html>

    So I went to the API: http://java.sun.com/j2ee/1.4/docs/api/
    Looked up ServletResponse, then looked for the getOutputStream() method. It says:
    "Throws:
    IllegalStateException - if the getWriter method has been called on this response"
    You can call only one of the getWriter or getOutputStream methods, not both. You are calling both. When you use a JSP, a variable called 'out' is generated (a PrintWriter) from the the Writer you get when response.getWriter() is called. This is done before your code gets executed as one of the functions that occur when a JSP is translated to a Servlet. You then write to that out variable when you print the HTML in the JSP code.
    This is best done in a Servlet, not a JSP, since there is no display and you require control over the servlet response.

  • Connection has already been created in this tx context for pool named cgPoo

    Hi all,
    First of all apologies, as I know there have been multiple posts on the above issue but I have not as yet been able to resolve the issue.
    I am using weblogic 8.1 sp3 to develop a portal. As you are aware on the domain creation a connection pool cg pool is created. I am using an oracle driver (oraclei 8.1.7 thin ).
    I have to create another jdbc ( clin_live )connection pool, which I also use the oracle 8 (oraclei 8.1.7 thin) and when I create the data source ( clinPool) for this I check the "emulate 2 phase commit".
    The connection pool and the data source both deploy ok but when I use the clinPool datasource I get the following error.
    Failure=java.sql.SQLException: Connection has already been created in this tx context for pool named cgPool. Illegal attempt to create connection from another pool: clin_live [ServiceException]>
    From the previous posts I understand that weblogic will let you have only one non-xa connection pool and cgPool must be non-xa.
    In trying to resolve this I have created the pool using the oracle thin XA driver without much luck.
    If any one has a solution I would be very grateful.
    Many thanks,
    Niambh

    Niambh,
    you can have only one non-xa datasource participating in a transaction. Emulating or faking XA means only that WLS does first all the operations for the XA resources, then the one non xa, and based on the result of this either commit or rollback.
    So obviously only one resource can "emulate 2PC).
    But there can be as many non XA db connections as you want, as long as they are not participating in the transaction.
    Check your datasources.
    I think the reason to use non-XA driver and "emulate 2PC" for Oracle is mainly the poor performance of the XA driver prior to 10g.
    Check also, if your Oracle database is XA enabled at all. I have seen some issues with customers, where the necessary PL/SQL packages have not been installed and therefore the thin XA driver did not work.
    -Kai

  • OC4J Error== java.io.IOException: Data has already been flushed to the cli

    Hi All,
    I deployed a J2EE Application in Oracle Application Server OC4J Instance.
    while testing the application i got the error
    java.io.IOException: Data has already been flushed to the client
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.EvermindJSPWriter.clear(EvermindJSPWriter.java:308)
    at PricingCriteria.jspService(_PricingCriteria.java:135)
    [SRC:/PricingCriteria.jsp:401]
    at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g(10.1.2.2.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:834)
    at com.evermind[Oracle Application Server Containers for J2EE 10g(10.1.2.2.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:228)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Please help me in this issue.
    Thanks in Advance,
    Salih KM
    null

    Your error is because you have already flushed or closed your output stream. Your response is done but you are trying to forward after the fact.

  • SharePoint Search Service upgrade to 2013 fails: "Inner Exception: An item with the same key has already been added."

    Here's the situation:
    Upgrading a SharePoint Server 2010 Search Service Application dB to our SharePoint 2013 SP 1 development environment, using the Management Shell
    Running the following commands: 
    $applicationPool= Get-SPServiceApplicationPool -Identity 'SearchService_AppPool'
    $searchInst = Get-SPEnterpriseSearchServiceInstance -local
    Restore-SPEnterpriseSearchServiceApplication -Name 'SearchServiceApplication' -applicationpool $applicationPool -databasename 'SearchServiceApplicationDB' -databaseserver SERVERNAME -AdminSearchServiceInstance $searchInst
    Creates the search dBs (crawl, links, analytics) successfully; however, in the end, I get....
    "Exception: Action 15.0.107.0 of Microsoft.Office.Server.Search.Upgrade.SearchAdminDatabaseSequence failed."
    Looking at the ULS logs, I find the following:
    Inner Exception: An item with the same key has already been added.
    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)     at Microsoft.Office.Server.Search.Administration.OOTBSchemaDefinition.FindAndFixExistingManagedProperties()     at Microsoft.Office.Server.Search.Administration.OOTBSchemaDefinition.InstallManagedProperties(Boolean
    upgrade)     at Microsoft.Office.Server.Search.Administration.OOTBSchemaDefinition.Upgrade()     at Microsoft.Office.Server.Search.Upgrade.UpdateAllOOTBProperties.Upgrade()     at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()
    Exception: Action 15.0.107.0 of Microsoft.Office.Server.Search.Upgrade.SearchAdminDatabaseSequence failed.
    at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()     at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.Upgrade()     at Microsoft.Office.Server.Search.Upgrade.SearchDatabaseSequence.Upgrade()     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object
    o, Boolean bRecurse)
    Anyone encounter anything like this during their search upgrade process? I'm not honestly even sure what duplicate value to look for at this point, if I were to run a SELECT Id, ClassId, ParentId, Name, Status, Version, Properties FROM Objects on
    "SharePoint_Config" in SSMS. Any insight or opinions on the matter are welcome; and thanks to those who choose to reply to this, in advance.

    Hi ,
    You can enable the ULS log on verbose level (note, remember to reset to default level after finished troubleshooting) for more information per the following article, then check there should be more useful message for helping solve the issue.
    http://www.brightworksupport.com/enabling-verbose-logging-to-compare-against-c/
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/12c99279-d3aa-46de-bc57-d5d250692ff0/upgrade-of-search-service-application-from-2010-to-2013-failure?forum=sharepointadmin
    https://www.simple-talk.com/blogs/2014/04/22/sharepoint-2010-to-2013-search-service-application-upgrade-issueaction-15-0-80-0-fails/http://blogs.msdn.com/b/biyengar/archive/2009/10/27/psconfig-failure-with-error-an-item-with-the-same-key-has-already-been-added.aspx
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

Maybe you are looking for