'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?

Similar Messages

  • 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,

  • 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

  • Connection has already been created in this tx ctxt for pool named cgPool

    Hi,
    I am getting the below error when I try to call a DB Control( pointing to DB2) when I run my Process in Weblogic WorkShop( BEA WeblogicWorkShop8.1.4)
    <b>Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named cgPool. Illegal attempt to create connection from another pool: Mypool</b>
    I even tried changing MyPool as XA- Connection Pool.
    I set the cgPool to Emulate 2phaseCommit- non XA.
    Still the error is occuring. I am not able to call any of my methods of the DB Control.
    MyPool is pointing to a DB2 Server.
    If Any of you guys have got a solution . Please post the solution on how to solve this problem!!
    Waiting for the Response
    Regards
    Ravi Upasi:O

    Hi,
    WebLogic Workshop uses a built-in connection pool, cgPool, to track conversation state. If you create a Database control that uses a data source created on a different connection pool, you may get an error that stating that you already have a transactional context created in the first pool (the one that Workshop is using to track state), and you cannot use data sources from two different connection pools within the same transaction. You can solve this problem by using a transactional (XA) driver.
    Solution: Please use a XA driver for your application pool and the error should go away.
    Thanks
    Vimala

  • 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

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

    Hello
              I can´t use WLS 6.0 I must use WLS 5.1. So I can´t to use distributed
              transactions.
              So that, Can I to simulate this situation???
              Client code:
              method
              UserTransaction.begin
              class1.create
              class2.updateDatabaseOracle1
              this.comit();
              Exception
              this.rollback();
              method commit
              class1.commit();
              class2.commit();
              UserTransaction.commit
              methdo rollback
              class1.rollback;
              class2.rollback;
              UserTransaction.rollback
              class1
              create
              EJBCreate
              commit
              EJB.putData
              rollback
              EJB.remove
              I get this Error:
              "Connection has already been created in this tx context for pool
              named pool1. Illegal attempt to create connection from another
              pool: pool2"
              Please Help How can I do it?
              Miguel Lopez Montero
              Soluziona Servicios Internet,Spain
              

    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

  • Simple Entity Bean JWS fails: Connection has already been created in this tx context

    I am new to Weblogic Workshop 8.1, and trying to create an EntityBean from a pre-existing
    database table.
    I get an error that indicates the JWS is using the default cgPool rather then
    my new pool for some transaction.
    I added my database (DB2) pool and data source, and then created an entity bean
    using "New Entity Bean from database table.
    I then wrapped this Entity Bean in a control and generated a JWS.
    When I run the JWS and execute FindByPrimaryKey, I get the following error:
    Submitted at Friday, April 2, 2004 11:07:30 AM CST
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Couldn't get connection:
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:410)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:141)

    I am new to Weblogic Workshop 8.1, and trying to create an EntityBean from a pre-existing
    database table.
    I get an error that indicates the JWS is using the default cgPool rather then
    my new pool for some transaction.
    I added my database (DB2) pool and data source, and then created an entity bean
    using "New Entity Bean from database table.
    I then wrapped this Entity Bean in a control and generated a JWS.
    When I run the JWS and execute FindByPrimaryKey, I get the following error:
    Submitted at Friday, April 2, 2004 11:07:30 AM CST
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Couldn't get connection:
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:410)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:141)

  • SQLException: Connection has already been created in this tx context for...

    I get this Exception when i try to do persistance in one Oracle database after i received data from another Oracle database
    2010-08-24 10:41:44,185 2497 [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR com.btick.ejb.db.MauSqlMapClient - excepcion al intentar ejecutar statement [CLIENTS.RegistrarMovimientos]
    java.sql.SQLException: Connection has already been created in this tx context for pool named ConnPoolClient. Illegal attempt to create connection from another pool: ConnPoolStore
         at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:608)
         at weblogic.jdbc.jts.Driver.connect(Driver.java:127)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
         at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
         at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
         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.btick.ejb.db.EntelSqlMapClient.queryForObject(MauSqlMapClient.java:150)
         at com.btick.ejb.archivos.SyniverseBean.persistData(SynBean.java:127)
         at com.btick.ejb.archivos.SyniverseBean.persist(SynBean.java:121)
    Can u help me how to solve this?
    I tried using differents drivers.
    Thanx in advance!

    Hi Mgaldames,
    Please refer to : http://weblogic-wonders.com/weblogic/forums/ejb-webservices-dev/#comment-1620
    Thanks
    Jay SenSharma

  • Connection has already been created in this tx context

    Hi All,
    I am experiencing this problem and I am not able to find the solution for this.
    Please help.
    I have stateless EJB ('REQUIRED') and within that I have many EJB's using 'SUPPORTS'
    as transaction and in the flow I am also calling DAO object which invokes JDBC
    ( using TXDataSource) call from different Datasource from the one above EJB.
    I get SQL EXception as
    "SQLException while getting DB connection : Connection has already been created
    in this tx context for pool named oraclePool. Illegal attempt to create connection
    from another pool: sybPool "
    I am not able to figure out why this error is coming. Any help will be appreciated!
    Regards
    SH

    Hi all,
    I am facing this same problem
    i am using database for weblogic integrator
    Pointbase
    and oracle for my system.
    I didn't get the what u meant by XA driver
    Regards,
    Cleophus Pereira
    "Slava Imeshev" <[email protected]> wrote:
    Hi Sanjeev,
    Slava
    "Sanjeev" <[email protected]> wrote in message
    news:3d6f55bd$[email protected]..
    Hi All,
    I am experiencing this problem and I am not able to find the solutionfor this.
    Please help.
    I have stateless EJB ('REQUIRED') and within that I have many EJB'susing
    'SUPPORTS'
    as transaction and in the flow I am also calling DAO object which invokesJDBC
    ( using TXDataSource) call from different Datasource from the one aboveEJB.
    I get SQL EXception as
    "SQLException while getting DB connection : Connection has alreadybeen
    created
    in this tx context for pool named oraclePool. Illegal attempt to createconnection
    from another pool: sybPool "
    I am not able to figure out why this error is coming. Any help willbe
    appreciated!
    Regards
    SH

  • 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

  • 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.

  • 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                                                                                                                                                                                                                                                                       

  • 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

  • The ConnectionString property has not been initialized random error

    Hi,
    Can someone please help me?
    I randomly get an error when running my website:
    The ConnectionString property has not been initialized.
    First time I run the web page it works. Second time it fails. Is this got anything to do with static methods?
    This is my code in DAL layer:
    ConStrings.cs
    public class ConStrings
    /// </summary>
    public static string PizzaDeliveryConnectionString
    get
    // get from PL web.config
    string myconnectionString = ConfigurationManager.ConnectionStrings["PizzaDeliveryConnectionString"].ConnectionString;
    return myconnectionString;
    public static SqlConnection GetPizzaDeliveryConnection()
    return new SqlConnection(PizzaDeliveryConnectionString);
    DLCustomer.cs
    public class DLCustomer
    static SqlConnection connString = DL.ConStrings.GetPizzaDeliveryConnection();
    public static DataSet GetCustomerByPhoneNumber(string phonenumber)//static is good for returing data from db
    DataSet ds = null;
    ds = new DataSet();
    try
    using (var connection = connString)//using doesn't require connection closed
    connection.Open();
    using (SqlCommand cmd = new SqlCommand("GetCustomerByPhoneNumber", connection))
    cmd.Connection = connection;
    cmd.CommandType = System.Data.CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@phonenumber", phonenumber);
    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
    da.Fill(ds, "CustomersTable");
    return ds;
    catch (SqlException ex)
    return ds;
    BUSINESS LAYER
    Customer.cs
    public class Customer
    private string phonenumber;
    private DL.DLCustomer customerData;
    public int CustomerId { get; set; }
    public string CustomerName { get; set; }
    public String PhoneNumber
    get
    return this.phonenumber;
    set
    this.phonenumber = value;
    if (this.PhoneNumber == "")
    throw new Exception("Please provide Tel ...");
    public Customer () // Default Constructor
    //An instance of the Data access layer!
    customerData = new DL.DLCustomer();
    /// Function Find customer. Calls the
    /// function in Data layer.
    /// It returns the details of the customer using
    /// customer ID via a Dataset to GUI tier.
    /// </SUMMARY>
    public static DataSet GetCustomerByPhoneNumber(Customer customer)
    if (customer.phonenumber == "")
    throw new Exception("Please provide phonenumber to search");
    DataSet data = null;
    data = DL.DLCustomer.GetCustomerByPhoneNumber(customer.phonenumber);
    return data;
    Presentation layer
    protected void btnOrder_Click(object sender, EventArgs e)
    Customer customer = new Customer();
    //string dt = Request.Form[txtDate.UniqueID];
    customer.PhoneNumber = txtPhoneNumber.Text;
    // ClassLibrary1.DbFunc1.GetCustomerByPhoneNumber(customer) ;
    rptCustomers.DataSource = Customer.GetCustomerByPhoneNumber(customer);
    rptCustomers.DataBind();
    web.config
    <configuration>
    <connectionStrings>
    <add name="PizzaDeliveryConnectionString" connectionString="Data Source=mycomp;Initial Catalog=PizzaDelivery;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

    Hi
    collie12,
    Since you develop in web page. Please try to use
    System.Web.Configuration.WebConfigurationManager.ConnectionStrings["YouConnStringName"].ConnectionString;
    This requires references to System.Configuration.dll and System.Web.dll.
    WebConfigurationManager.ConnectionStrings Property gets the Web site's connection strings.
    Please also try to remove your static keyWords, it will have an effect on "using" statement.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for